/* Invoice Generator Styles */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --background: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.app-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.5rem;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.step {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all 0.2s;
}

.step.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.step.completed {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

/* Step Content */
.step-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.step-content.hidden {
    display: none;
}

.step-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.step-description {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[type="file"] {
    font-size: 0.875rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: 400;
}

.logo-preview {
    margin-top: 0.5rem;
}

.logo-preview img {
    max-width: 150px;
    max-height: 80px;
    border-radius: var(--radius);
}

/* Invoice Meta Grid */
.invoice-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Line Items */
.line-items-table {
    margin-bottom: 1.5rem;
}

.line-items-header {
    display: grid;
    grid-template-columns: 1fr 80px 100px 100px 40px;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.line-item {
    display: grid;
    grid-template-columns: 1fr 80px 100px 100px 40px;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.line-item input {
    padding: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

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

.line-item .col-amount {
    text-align: right;
    font-weight: 500;
    padding-right: 0.5rem;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-remove:hover {
    opacity: 1;
}

.btn-add {
    margin-top: 0.5rem;
    background: none;
    border: 1px dashed var(--border);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-add:hover {
    background: var(--background);
    border-color: var(--primary);
}

/* Totals */
.totals-section {
    border-top: 2px solid var(--border);
    padding-top: 1rem;
    margin-bottom: 1.5rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
}

.tax-row input {
    width: 60px;
    padding: 0.25rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.total-final {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

/* Buttons */
.button-row {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--background);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Preview */
.preview-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.invoice-preview-wrapper {
    background: var(--background);
    padding: 2rem;
    border-radius: var(--radius);
    overflow: auto;
}

.invoice-preview {
    background: white;
    padding: 3rem;
    max-width: 8.5in;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    line-height: 1.5;
}

/* Invoice Template Styles */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
}

.invoice-logo img {
    max-width: 150px;
    max-height: 80px;
}

.invoice-title {
    text-align: right;
}

.invoice-title h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.invoice-title p {
    color: var(--text-light);
    margin: 0.25rem 0;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.invoice-party h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.invoice-party p {
    margin: 0.25rem 0;
}

.invoice-party strong {
    font-size: 1rem;
}

.invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.invoice-items-table th {
    background: var(--background);
    padding: 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
}

.invoice-items-table th:last-child,
.invoice-items-table td:last-child {
    text-align: right;
}

.invoice-items-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.invoice-totals-table {
    width: 250px;
}

.invoice-totals-table tr td {
    padding: 0.5rem 0;
}

.invoice-totals-table tr td:last-child {
    text-align: right;
    font-weight: 500;
}

.invoice-totals-table tr.total-row td {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 2px solid var(--border);
    padding-top: 0.75rem;
}

.invoice-notes {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.875rem;
}

.invoice-notes h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 640px) {
    .app-container {
        padding: 1rem;
    }
    
    .step-content {
        padding: 1.5rem;
    }
    
    .line-items-header,
    .line-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .line-items-header {
        display: none;
    }
    
    .line-item {
        padding: 1rem;
        background: var(--background);
        border-radius: var(--radius);
        margin-bottom: 0.5rem;
    }
    
    .line-item input {
        width: 100%;
    }
    
    .invoice-parties {
        grid-template-columns: 1fr;
    }
    
    .invoice-preview {
        padding: 1.5rem;
    }
    
    .preview-actions {
        flex-direction: column;
    }
    
    .preview-actions .btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .app-header,
    .button-row,
    .preview-actions,
    .step-indicator {
        display: none !important;
    }
    
    .invoice-preview-wrapper {
        padding: 0;
        background: white;
    }
    
    .invoice-preview {
        box-shadow: none;
    }
}
