/* Brand Colors */
:root {
    --off-white: #FEFEFE;
    --off-black: #202121;
    --calm-blue: #17375C;
    --electric-yellow: #FFC843;
    --light-gray: #E5E7EB;
    --gray-600: #6B7280;
    --gray-400: #9CA3AF;
    --gray-300: #D1D5DB;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--off-white);
    color: var(--off-black);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Invoice Form */
.invoice-form {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin: 2rem 0;
    border-top: 4px solid var(--calm-blue);
}

/* Logo Section */
.logo-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.logo-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-container {
    position: relative;
}

.logo-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--calm-blue);
    border: 2px dashed var(--calm-blue);
    cursor: pointer;
    transition: all 0.2s;
}

.logo-placeholder:hover {
    background-color: #1e4a6b;
}

.logo-text {
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
}

.logo-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 0.5rem;
    border: 2px solid var(--calm-blue);
}

.logo-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.logo-button {
    background: none;
    border: none;
    color: var(--calm-blue);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
    text-align: left;
}

.logo-button:hover {
    color: #1e4a6b;
}

.logo-hint {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* Invoice Number Section */
.invoice-number-section {
    display: flex;
    align-items: center;
}

.invoice-number-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.invoice-number-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--off-black);
    white-space: nowrap;
}

.invoice-number-input {
    width: 200px;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--light-gray);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.invoice-number-input:focus {
    outline: none;
    border-color: var(--calm-blue);
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--off-black);
    margin-bottom: 1rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--off-black);
    margin-bottom: 0.25rem;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--light-gray);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--calm-blue);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Form Rows */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Input with Button */
.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button .form-input {
    flex: 1;
}

.edit-button {
    padding: 0.5rem 1rem;
    border: 2px solid var(--electric-yellow);
    background: white;
    color: var(--off-black);
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.edit-button:hover {
    background-color: #fff8e1;
}

/* Line Items Table */
.table-container {
    border: 2px solid var(--calm-blue);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.line-items-table {
    width: 100%;
    border-collapse: collapse;
}

.line-items-table thead {
    background-color: var(--off-black);
}

.line-items-table th {
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
}

.line-items-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--light-gray);
}

.line-items-table tr:last-child td {
    border-bottom: none;
}

.line-item-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--light-gray);
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.line-item-input:focus {
    outline: none;
    border-color: var(--calm-blue);
}

.line-item-textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--light-gray);
    border-radius: 0.25rem;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 60px;
}

.line-item-textarea:focus {
    outline: none;
    border-color: var(--calm-blue);
}

.quantity-input,
.cost-input {
    width: 80px;
    text-align: center;
}

.total-cell {
    font-weight: bold;
    color: var(--off-black);
}

.remove-item-button {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.2s;
}

.remove-item-button:hover {
    background: #dc2626;
}

/* Add Item Button */
.add-item-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--calm-blue);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.add-item-button:hover {
    background-color: #1e4a6b;
}

/* Totals Section */
.totals-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.totals-container {
    width: 320px;
    padding: 1.5rem;
    background-color: var(--off-white);
    border: 2px solid var(--calm-blue);
    border-radius: 0.5rem;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.totals-row:last-child {
    margin-bottom: 0;
}

.discount-section,
.tax-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.discount-button {
    background: none;
    border: none;
    color: var(--electric-yellow);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
}

.discount-button:hover {
    color: #e6b800;
}

.discount-input,
.tax-input {
    width: 80px;
    padding: 0.25rem;
    border: 2px solid var(--light-gray);
    border-radius: 0.25rem;
    text-align: center;
    font-size: 0.875rem;
}

.discount-input:focus,
.tax-input:focus {
    outline: none;
    border-color: var(--calm-blue);
}

.tax-input {
    width: 60px;
}

.total-amount {
    font-weight: bold;
    font-size: 1.125rem;
    color: var(--off-black);
}

.total-row {
    border-top: 2px solid var(--calm-blue);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.total-label {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--off-black);
}

.final-total {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--calm-blue);
}

/* Generate Button */
.generate-section {
    text-align: center;
}

.generate-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 3rem;
    background-color: var(--electric-yellow);
    color: var(--off-black);
    border: none;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.generate-button:hover {
    background-color: #e6b800;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .invoice-form {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .logo-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .logo-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .invoice-number-section {
        align-self: stretch;
    }
    
    .invoice-number-container {
        justify-content: space-between;
    }
    
    .invoice-number-input {
        width: 150px;
    }
    
    .totals-section {
        justify-content: center;
    }
    
    .totals-container {
        width: 100%;
        max-width: 320px;
    }
    
    .line-items-table {
        font-size: 0.875rem;
    }
    
    .line-items-table th,
    .line-items-table td {
        padding: 0.5rem;
    }
    
    .generate-button {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .line-items-table th:nth-child(2),
    .line-items-table td:nth-child(2) {
        display: none;
    }
    
    .quantity-input,
    .cost-input {
        width: 60px;
    }
}

