/* AI Invoice Generator Pro - Enhanced Styles */

/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Touch targets for mobile */
.touch-target {
    min-height: 44px;
    min-width: 44px;
}

/* Dark mode variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-primary: #e2e8f0;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
}

.dark {
    --bg-primary: #1f2937;
    --bg-secondary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-primary: #4b5563;
    --accent-blue: #60a5fa;
    --accent-green: #34d399;
    --accent-red: #f87171;
    --accent-purple: #a78bfa;
}

/* Invoice Preview Styles */
.invoice-preview {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    min-height: 850px;
    max-height: 105vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    position: relative;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) var(--bg-secondary);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.dark .invoice-preview {
    background: #111827;
    border-color: #374151;
    color: #f9fafb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.invoice-header {
    border-bottom: 3px solid var(--accent-blue);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--border-primary) 100%);
    padding: 1.5rem;
    border-radius: 8px;
    margin: -1.5rem -1.5rem 2rem -1.5rem;
    text-align: center;
    position: relative;
}

.dark .invoice-header {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
}

/* Logo styling */
.invoice-logo {
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    max-height: 60px;
    max-width: 150px;
    object-fit: contain;
}

.invoice-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.invoice-number {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.invoice-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
}

.invoice-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.client-info h3,
.company-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-primary);
}

.info-content {
    padding: 0.5rem 0;
}

.client-name,
.company-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.client-email,
.company-email {
    color: var(--accent-blue);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.client-address,
.company-address {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background: var(--bg-primary);
}

.dark .items-table {
    background: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.items-table th {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #1d4ed8 100%);
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.items-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--bg-primary);
}

.dark .items-table td {
    background: #1f2937;
    border-color: #374151;
}

.items-table tr:nth-child(even) td {
    background-color: var(--bg-secondary);
}

.dark .items-table tr:nth-child(even) td {
    background-color: #374151;
}

.items-table tr:hover td {
    background-color: rgba(59, 130, 246, 0.05);
    transition: background-color 0.2s ease;
}

.dark .items-table tr:hover td {
    background-color: rgba(96, 165, 250, 0.1);
}

/* Items Section */
.items-section {
    margin-bottom: 2rem;
}

.items-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-primary);
}

.total-section {
    margin-top: 2rem;
    text-align: right;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--border-primary) 100%);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    position: relative;
    z-index: 10;
}

.dark .total-section {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border-color: #4b5563;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    align-items: center;
}

.total-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.total-value {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    text-align: right;
    font-size: 1rem;
}

.grand-total {
    border-top: 3px solid var(--accent-blue);
    padding-top: 1rem;
    margin-top: 1rem;
    font-size: 1.125rem;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .grand-total {
    background: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.grand-total .total-label {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.grand-total .total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-blue);
}

/* Invoice Footer */
.invoice-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e2e8f0;
}

.footer-text {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.footer-note {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
    font-style: italic;
}

.payment-terms {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.payment-terms h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.payment-terms ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.payment-terms li {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.payment-terms li::before {
    content: "•";
    color: #3b82f6;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.additional-info {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.additional-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.additional-info p {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

/* Form Item Styles */
.item-row {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1.2fr auto auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 0;
    padding: 1.25rem;
    background: var(--bg-primary);
    border-radius: 0.75rem;
    border: 2px solid var(--border-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    min-width: 0;
}

.item-row:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .item-row:hover {
    border-color: #60a5fa;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.item-row input {
    padding: 0.75rem;
    border: 2px solid var(--border-primary);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-width: 0;
    width: 100%;
}

.dark .item-row input {
    background: #374151;
    border-color: #4b5563;
}

.item-row input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--bg-primary);
}

.dark .item-row input:focus {
    background: #1f2937;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.item-row input[readonly] {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
}

.dark .item-row input[readonly] {
    background: #4b5563;
    color: #9ca3af;
}

.remove-item {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-item:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.remove-item svg {
    width: 16px;
    height: 16px;
}

/* Enhanced Responsive Design */
@media (max-width: 1280px) {
    .invoice-layout {
        grid-template-columns: 1fr 1.2fr !important;
    }
}

@media (max-width: 1024px) {
    .invoice-layout {
        grid-template-columns: 1fr !important;
    }
    
    .invoice-details {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .item-row {
        grid-template-columns: 2fr 0.8fr 1fr auto;
        gap: 0.5rem;
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .invoice-preview {
        padding: 1rem;
        max-height: 80vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .invoice-header {
        padding: 1rem;
        margin: -1rem -1rem 1.5rem -1rem;
    }
    
    .invoice-title {
        font-size: 2rem;
    }
    
    .invoice-logo {
        max-height: 40px;
        max-width: 100px;
    }
    
    .item-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .ai-suggest-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .remove-item {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .items-table {
        font-size: 0.8rem;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    .items-table thead,
    .items-table tbody,
    .items-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    .items-table th,
    .items-table td {
        padding: 0.75rem 0.5rem;
        word-wrap: break-word;
    }
    
    .total-section {
        padding: 1rem;
        margin-top: 1.5rem;
    }
    
    .total-row {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25rem;
    }
    
    .touch-target {
        min-height: 48px;
        min-width: 48px;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 640px) {
    .invoice-preview {
        padding: 0.75rem;
    }
    
    .invoice-header {
        padding: 0.75rem;
        margin: -0.75rem -0.75rem 1rem -0.75rem;
    }
    
    .invoice-title {
        font-size: 1.75rem;
    }
    
    .items-table th,
    .items-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
}

/* Print Styles for PDF */
@media print {
    .invoice-preview {
        border: none;
        box-shadow: none;
        padding: 0;
        max-height: none;
        overflow: visible;
    }
    
    body {
        background: white;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button Hover Effects */
button {
    transition: all 0.2s ease-in-out;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Form Validation Styles */
input:invalid,
input.validation-error {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    background-color: #fef2f2;
}

input:valid:not(.validation-error) {
    border-color: var(--accent-green);
}

textarea:invalid,
textarea.validation-error {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    background-color: #fef2f2;
}

textarea:valid:not(.validation-error) {
    border-color: var(--accent-green);
}

select:invalid,
select.validation-error {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

select:valid:not(.validation-error) {
    border-color: var(--accent-green);
}

/* Validation Error Messages */
.validation-message {
    color: var(--accent-red);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
    display: block;
}

/* Download button disabled state */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Invoice Preview Scrollbar */
.invoice-preview {
    overflow-y: scroll !important;
}

.invoice-preview::-webkit-scrollbar {
    width: 8px;
    display: block !important;
}

.invoice-preview::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.invoice-preview::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 4px;
    border: 1px solid #1d4ed8;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.invoice-preview::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border-color: #1e40af;
    transform: scaleX(1.1);
}

.invoice-preview::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    border-color: #1e3a8a;
}

/* Firefox scrollbar */
.invoice-preview {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 #f1f5f9;
}

/* Items Container */
#itemsContainer {
    overflow-x: auto;
    min-width: 0;
}

/* Invoice Layout */
.invoice-layout {
    grid-template-columns: 1fr 1.4fr !important;
}

/* Extra large screens - maximize preview space */
@media (min-width: 1536px) {
    .invoice-layout {
        grid-template-columns: 1fr 1.6fr !important;
    }
    
    .invoice-preview {
        max-height: 90vh;
    }
}

@media (max-width: 1280px) {
    .invoice-layout {
        grid-template-columns: 1fr 1.2fr !important;
    }
}

@media (max-width: 1024px) {
    .invoice-layout {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Additional Modern Styling */
.font-inter {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Focus states for accessibility */
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: var(--accent-green);
    color: white;
}

.notification.error {
    background-color: var(--accent-red);
    color: white;
}

.notification.info {
    background-color: var(--accent-blue);
    color: white;
}

.notification-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.dark .modal-content {
    background-color: #1f2937;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
    background-color: var(--border-primary);
}

.btn-success {
    background-color: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.dark .btn-secondary {
    background-color: #374151;
    border-color: #4b5563;
}

.dark .btn-secondary:hover {
    background-color: #4b5563;
}

.input-field {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-primary);
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
}

.dark .input-field {
    background-color: #374151;
    border-color: #4b5563;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Template list */
.template-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
}

.template-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-primary);
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-item:hover {
    background-color: var(--bg-secondary);
}

.dark .template-item:hover {
    background-color: #374151;
}

.template-item:last-child {
    border-bottom: none;
}

.template-item-actions {
    display: flex;
    gap: 0.5rem;
}

.template-delete-btn {
    background: none;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.template-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Logo preview styling */
.logo-preview-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-preview-image {
    max-height: 60px;
    max-width: 150px;
    object-fit: contain;
    border-radius: 0.5rem;
    border: 1px solid var(--border-primary);
}

.logo-preview-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Form section styling */
.form-section {
    margin-bottom: 1.5rem;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-grid-full {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid-full {
        grid-column: span 1;
    }
}

/* Control buttons styling */
.control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

.control-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.control-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-save {
    background-color: var(--accent-green);
    color: white;
}

.btn-load {
    background-color: var(--accent-purple);
    color: white;
}

.btn-clear {
    background-color: var(--accent-red);
    color: white;
}

/* Company info section */
.company-info-section {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-primary);
    transition: all 0.3s ease;
}

.dark .company-info-section {
    background: #374151;
    border-color: #4b5563;
}

.company-info-section:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.dark .company-info-section:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Client info section */
.client-info-section {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-primary);
    transition: all 0.3s ease;
}

.dark .client-info-section {
    background: #374151;
    border-color: #4b5563;
}

.client-info-section:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.dark .client-info-section:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Invoice info section */
.invoice-info-section {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-primary);
    transition: all 0.3s ease;
}

.dark .invoice-info-section {
    background: #374151;
    border-color: #4b5563;
}

.invoice-info-section:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.dark .invoice-info-section:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Items section */
.items-section-form {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-primary);
    transition: all 0.3s ease;
}

.dark .items-section-form {
    background: #374151;
    border-color: #4b5563;
}

.items-section-form:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.dark .items-section-form:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Tax section */
.tax-section {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 2px solid var(--border-primary);
    transition: all 0.3s ease;
}

.dark .tax-section {
    background: #374151;
    border-color: #4b5563;
}

.tax-section:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.dark .tax-section:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Header controls */
.header-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* AI Suggestion Button - Improved styling */
.ai-suggest-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    position: relative;
    overflow: hidden;
}

.ai-suggest-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.ai-suggest-btn:active {
    transform: translateY(0);
}

.ai-suggest-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-suggest-btn .loading {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

.ai-loading {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    font-style: italic;
}

.dark .ai-loading {
    background-color: #4b5563 !important;
    color: #9ca3af !important;
}

/* Update item row grid to accommodate AI button properly */
.item-row {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1.2fr auto auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 0;
    padding: 1.25rem;
    background: var(--bg-primary);
    border-radius: 0.75rem;
    border: 2px solid var(--border-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    min-width: 0;
}

.item-row:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .item-row:hover {
    border-color: #60a5fa;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments for item row */
@media (max-width: 768px) {
    .item-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .ai-suggest-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}
