/* Professional Invoice & Devis Style for Fali.ai */
:root {
    --primary: #06b6d4;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

.invoice-preview {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    color: var(--text);
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 1.5rem;
}

.inv-company {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.inv-logo {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
}

.inv-company h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.inv-company p {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.inv-meta {
    text-align: right;
}

.inv-meta h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
}

.inv-meta p {
    margin: 0.5rem 0 0;
    font-weight: 700;
    font-size: 0.95rem;
}

.inv-billto {
    margin-bottom: 2.5rem;
}

.inv-billto h4 {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.inv-billto p {
    margin: 0;
    font-weight: 700;
    font-size: 1.125rem;
}

.inv-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2.5rem;
    font-size: 0.9rem;
}

.inv-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.inv-table th:first-child { border-radius: 8px 0 0 0; }
.inv-table th:last-child { border-radius: 0 8px 0 0; text-align: right; }

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

.inv-table td:last-child {
    text-align: right;
    font-weight: 700;
}

.inv-totals {
    display: flex;
    justify-content: flex-end;
}

.inv-totals-box {
    width: 280px;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
}

.inv-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.inv-total-row.grand {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--border);
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--primary);
}

.inv-notes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border);
}

.inv-notes h4 {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.inv-notes p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

.inv-signature {
    margin-top: 4rem;
    display: flex;
    justify-content: flex-end;
    text-align: center;
}

.inv-sig-box {
    width: 200px;
}

.sig-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 700;
}

.sig-image {
    max-height: 80px;
    max-width: 100%;
    margin-bottom: 0.5rem;
}

.sig-line {
    border-bottom: 1px solid var(--text);
    margin-bottom: 0.5rem;
}

.sig-name {
    font-size: 0.85rem;
    font-weight: 700;
}

/* Print Overrides */
#print-container {
    display: none;
    position: fixed;
    left: -200%;
    top: 0;
    width: 210mm;
    background: white;
    z-index: -1;
}

@media print {
    body > *:not(#print-container) {
        display: none !important;
    }

    #print-container {
        display: block !important;
        position: relative !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 999999 !important;
        background: white !important;
    }

    .invoice-preview {
        box-shadow: none !important;
        border: none !important;
        padding: 15mm !important;
        width: 100% !important;
        margin: 0 !important;
        background: white !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

@page {
    size: auto;
    margin: 0mm;
}

/* RTL Support */
[dir="rtl"] .inv-meta { text-align: left; }
[dir="rtl"] .inv-table th { text-align: right; }
[dir="rtl"] .inv-table th:first-child { border-radius: 0 8px 0 0; }
[dir="rtl"] .inv-table th:last-child { border-radius: 8px 0 0 0; text-align: left; }
[dir="rtl"] .inv-table td:last-child { text-align: left; }
[dir="rtl"] .inv-totals { justify-content: flex-start; }
[dir="rtl"] .inv-signature { justify-content: flex-start; }
