/* Invoice Generator Styles */

.invoice-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.invoice-header {
    text-align: center;
    margin-bottom: 2rem;
}

.invoice-header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.invoice-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.invoice-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Form Section */
.invoice-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.form-section h3 {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h3 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

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

/* Add Item Button */
.btn-add-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-item:hover {
    background: rgba(88, 101, 242, 0.1);
}

/* Items Table */
.items-table {
    background: var(--dark-bg);
    border-radius: 8px;
    overflow: hidden;
}

.items-header {
    display: grid;
    grid-template-columns: 1fr 80px 100px 100px 40px;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(88, 101, 242, 0.1);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

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

.item-row:last-child {
    border-bottom: none;
}

.item-row input {
    padding: 0.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
}

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

.item-amount {
    color: var(--text-light);
    font-weight: 500;
    text-align: right;
}

.btn-remove-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-remove-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Totals */
.totals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.discount-input {
    display: flex;
    gap: 0.5rem;
}

.discount-input input {
    flex: 1;
    min-width: 0;
}

.discount-input select {
    width: 80px;
}

/* Notes */
#invoiceNotes {
    width: 100%;
    min-height: 80px;
}

/* Preview Section */
.invoice-preview-wrapper {
    position: sticky;
    top: 2rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-header h3 {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
}

.preview-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-primary,
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

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

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

/* Invoice Preview */
.invoice-preview {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.preview-content {
    padding: 2rem;
    color: #1a1a1a;
    font-size: 14px;
    min-height: 600px;
}

/* Preview Invoice Styles */
.preview-invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #5865f2;
}

.preview-business-info h2 {
    color: #5865f2;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.preview-business-info p {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

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

.preview-invoice-title h1 {
    font-size: 2rem;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.preview-invoice-title p {
    color: #666;
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

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

.preview-party h3 {
    color: #5865f2;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.preview-party p {
    color: #333;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.preview-party strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

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

.preview-items-table th {
    background: #f8f9fa;
    color: #333;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}

.preview-items-table th:last-child {
    text-align: right;
}

.preview-items-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    color: #333;
}

.preview-items-table td:last-child {
    text-align: right;
    font-weight: 500;
}

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

.preview-totals-table {
    width: 280px;
}

.preview-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: #666;
}

.preview-totals-row.total {
    border-top: 2px solid #5865f2;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    color: #1a1a1a;
    font-weight: 700;
    font-size: 1.1rem;
}

.preview-notes {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.preview-notes h4 {
    color: #333;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.preview-notes p {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    color: var(--text-light);
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 1200px) {
    .invoice-layout {
        grid-template-columns: 1fr;
    }

    .invoice-preview-wrapper {
        position: static;
    }
}

@media (max-width: 768px) {
    .invoice-container {
        padding: 1rem;
    }

    .invoice-header h1 {
        font-size: 2rem;
    }

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

    .form-group.full-width {
        grid-column: 1;
    }

    .items-header {
        display: none;
    }

    .item-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }

    .item-row input::placeholder {
        font-size: 0.8rem;
    }

    .item-amount {
        text-align: left;
    }

    .btn-remove-item {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
    }

    .item-row {
        position: relative;
        padding-right: 3rem;
    }

    .preview-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .preview-actions {
        flex-direction: column;
    }

    .preview-content {
        padding: 1rem;
    }

    .preview-invoice-header {
        flex-direction: column;
        gap: 1rem;
    }

    .preview-invoice-title {
        text-align: left;
    }

    .preview-parties {
        grid-template-columns: 1fr;
    }

    .totals-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .invoice-header h1 {
        font-size: 1.75rem;
    }

    .form-section {
        padding: 1rem;
    }

    .section-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .btn-add-item {
        justify-content: center;
    }
}
