/* Custom Styles for QuickInvoice Builder Pro */

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dark Mode Variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #374151;
    --border-color: #e5e7eb;
}

.dark {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --text-primary: #ffffff;
    --text-secondary: #d1d5db;
    --border-color: #374151;
}

/* Card Component */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.dark .card {
    background: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.dark .card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Section Title */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.dark .section-title {
    color: #ffffff;
}

/* Form Elements */
.label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.dark .label {
    color: #d1d5db;
}

.input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background-color: white;
    transition: all 0.2s ease;
}

.dark .input {
    background-color: #374151;
    border-color: #4b5563;
    color: #ffffff;
}

.input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input::placeholder {
    color: #9ca3af;
}

.dark .input::placeholder {
    color: #6b7280;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: #3b82f6;
    color: white;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: white;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .btn-secondary {
    background-color: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

.btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.dark .btn-secondary:hover {
    background-color: #4b5563;
    border-color: #6b7280;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Line Item Styles */
.line-item {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.dark .line-item {
    background-color: #374151;
    border-color: #4b5563;
}

.line-item:hover {
    border-color: #d1d5db;
}

.dark .line-item:hover {
    border-color: #6b7280;
}

/* Invoice Preview Styles */
.invoice-preview {
    background: white;
    padding: 40px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    min-height: 600px;
}

.dark .invoice-preview {
    background: #1f2937;
    border-color: #374151;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-draft {
    background-color: #f3f4f6;
    color: #6b7280;
}

.status-sent {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-paid {
    background-color: #d1fae5;
    color: #065f46;
}

.status-overdue {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-cancelled {
    background-color: #f3f4f6;
    color: #374151;
    text-decoration: line-through;
}

/* Invoice Templates */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.dark .invoice-header {
    border-bottom-color: #4b5563;
}

.invoice-logo {
    max-width: 150px;
    max-height: 80px;
    object-fit: contain;
}

.invoice-title {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.dark .invoice-title {
    color: #ffffff;
}

/* Template-specific styles */
.template-modern .invoice-title {
    color: #3b82f6;
}

.template-classic .invoice-title {
    color: #6b7280;
}

.template-minimal .invoice-title {
    color: #111827;
    font-weight: 400;
}

.template-professional .invoice-title {
    color: #1e293b;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.invoice-section {
    margin-bottom: 30px;
}

.invoice-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.dark .invoice-section-title {
    color: #9ca3af;
}

.invoice-info {
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
}

.dark .invoice-info {
    color: #d1d5db;
}

.invoice-info strong {
    color: #111827;
    font-weight: 600;
}

.dark .invoice-info strong {
    color: #ffffff;
}

/* Invoice Table */
.invoice-table {
    width: 100%;
    margin: 30px 0;
    border-collapse: collapse;
}

.invoice-table thead {
    background-color: #f9fafb;
}

.dark .invoice-table thead {
    background-color: #374151;
}

.invoice-table th {
    padding: 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e5e7eb;
}

.dark .invoice-table th {
    color: #d1d5db;
    border-bottom-color: #4b5563;
}

.invoice-table td {
    padding: 12px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.dark .invoice-table td {
    color: #d1d5db;
    border-bottom-color: #4b5563;
}

.invoice-table th:last-child,
.invoice-table td:last-child {
    text-align: right;
}

.invoice-table tbody tr:hover {
    background-color: #f9fafb;
}

.dark .invoice-table tbody tr:hover {
    background-color: #374151;
}

/* Invoice Totals */
.invoice-totals {
    margin-top: 30px;
    margin-left: auto;
    max-width: 300px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: #374151;
}

.dark .total-row {
    color: #d1d5db;
}

.total-row.subtotal,
.total-row.discount,
.total-row.tax {
    border-bottom: 1px solid #e5e7eb;
}

.dark .total-row.subtotal,
.dark .total-row.discount,
.dark .total-row.tax {
    border-bottom-color: #4b5563;
}

.total-row.grand-total {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 2px solid #111827;
}

.dark .total-row.grand-total {
    color: #ffffff;
    border-top-color: #ffffff;
}

/* Invoice Notes */
.invoice-notes {
    margin-top: 40px;
    padding: 20px;
    background-color: #f9fafb;
    border-radius: 8px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
}

.dark .invoice-notes {
    background-color: #374151;
    color: #9ca3af;
}

.invoice-notes strong {
    display: block;
    color: #374151;
    font-weight: 600;
    margin-bottom: 8px;
}

.dark .invoice-notes strong {
    color: #d1d5db;
}

/* Modal Styles */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s ease;
}

.dark .modal-content {
    background: #1f2937;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.dark .modal-header {
    border-bottom-color: #374151;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
}

.dark .modal-footer {
    border-top-color: #374151;
}

/* Dark Mode Toggle */
.dark .sun-icon {
    display: none;
}

.dark .moon-icon {
    display: block;
}

.moon-icon {
    display: none;
}

.dark .sun-icon {
    display: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
}

.dark .empty-state h3 {
    color: #9ca3af;
}

.empty-state p {
    font-size: 14px;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .invoice-preview {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .invoice-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .invoice-preview {
        padding: 20px;
    }
    
    .invoice-table {
        font-size: 12px;
    }
    
    .invoice-table th,
    .invoice-table td {
        padding: 8px;
    }
    
    header .flex {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    header .flex > div {
        width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.line-item {
    animation: fadeIn 0.3s ease;
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Smooth Transitions */
* {
    transition-property: background-color, border-color, color;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}