/**
 * FakturaIhned.cz — Styly pro PDF fakturu a tiskový výstup
 * Používáno v mPDF rendereru i v live náhledu
 */

/* === PDF FAKTURA === */
.invoice-pdf {
    font-family: freesans, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 10pt;
    line-height: 1.45;
    color: #1e293b;
    max-width: 100%;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 3px solid #2563eb;
}

.header-left {
    flex-shrink: 0;
}

.header-left .logo {
    max-width: 180px;
    max-height: 60px;
}

.header-right {
    text-align: right;
}

.invoice-title {
    font-size: 22pt;
    font-weight: 700;
    color: #2563eb;
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}

.invoice-number {
    font-size: 10pt;
    color: #64748b;
    margin: 0;
}

/* === STRANY (dodavatel / odběratel) === */
.parties {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.parties-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 10px 0;
    margin-bottom: 20px;
}

.parties-table td.party {
    width: 50%;
    vertical-align: top;
}

.party {
    flex: 1;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.party h2 {
    font-size: 8pt;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.party-name {
    font-size: 11pt;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.party p {
    font-size: 9.5pt;
    color: #475569;
    margin: 2px 0;
}

/* === PLATEBNÍ INFORMACE === */
.payment-info {
    margin-bottom: 20px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.info-table td {
    padding: 7px 12px;
    font-size: 9.5pt;
    border-bottom: 1px solid #f1f5f9;
}

.info-label {
    font-weight: 600;
    color: #64748b;
    width: 25%;
    white-space: nowrap;
}

.info-value {
    color: #1e293b;
}

/* === TEXTY PŘED/ZA POLOŽKAMI === */
.text-before,
.text-after {
    margin: 12px 0;
    padding: 10px 14px;
    background: #fffbeb;
    border-left: 3px solid #d97706;
    border-radius: 0 4px 4px 0;
    font-size: 9pt;
    color: #475569;
}

/* === TABULKA POLOŽEK === */
.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.items-table thead th {
    background: #1e293b;
    color: #ffffff;
    font-size: 8.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 10px;
    text-align: left;
}

.items-table thead th:first-child {
    border-radius: 6px 0 0 0;
}
.items-table thead th:last-child {
    border-radius: 0 6px 0 0;
}

.items-table tbody td {
    padding: 8px 10px;
    font-size: 9.5pt;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
}

.items-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.item-num {
    width: 30px;
    text-align: center;
    color: #94a3b8;
}

.item-desc {
    min-width: 160px;
}

.item-qty,
.item-unit {
    text-align: center;
    width: 60px;
}

.item-price,
.item-total {
    text-align: right;
    width: 90px;
    white-space: nowrap;
}

.item-vat {
    text-align: center;
    width: 60px;
}

/* === SOUHRN === */
.summary-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 20px;
}

/* Rekapitulace DPH */
.vat-summary {
    flex: 1;
}

.vat-summary h3 {
    font-size: 9pt;
    font-weight: 600;
    color: #64748b;
    margin: 0 0 6px 0;
}

.vat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
}

.vat-table th {
    background: #f1f5f9;
    padding: 4px 8px;
    font-size: 8pt;
    font-weight: 600;
    color: #64748b;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.vat-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f1f5f9;
}

.vat-table .money {
    text-align: right;
    white-space: nowrap;
}

/* Celkové částky */
.totals {
    min-width: 260px;
}

.totals-table {
    width: 100%;
    border-collapse: collapse;
}

.totals-table td {
    padding: 5px 10px;
    font-size: 9.5pt;
}

.total-label {
    text-align: right;
    color: #64748b;
    font-weight: 500;
}

.total-value {
    text-align: right;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}

.grand-total td {
    padding-top: 10px;
    border-top: 2px solid #1e293b;
}

.grand-total .total-label {
    font-size: 11pt;
    font-weight: 700;
    color: #1e293b;
}

.grand-total .total-value {
    font-size: 14pt;
    font-weight: 700;
    color: #2563eb;
}

/* === QR KÓD === */
.qr-section {
    text-align: right;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.qr-code {
    width: 120px;
    height: 120px;
}

.qr-label {
    font-size: 7pt;
    color: #94a3b8;
    margin-top: 4px;
}

/* === PATIČKA === */
.invoice-footer {
    margin-top: 24px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.invoice-footer p {
    font-size: 7pt;
    color: #94a3b8;
}

/* === LIVE NÁHLED (ve webovém preview panelu) === */
.preview-invoice {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 7px;
    line-height: 1.35;
    color: #1e293b;
    padding: 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    min-height: 400px;
}

.preview-invoice .invoice-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2563eb;
}

.preview-invoice .invoice-title {
    font-size: 14px;
    margin: 0;
}

.preview-invoice .invoice-number {
    font-size: 7px;
}

.preview-invoice .parties {
    gap: 10px;
    margin-bottom: 10px;
}

.preview-invoice .party {
    padding: 8px;
}

.preview-invoice .party h2 {
    font-size: 6px;
    margin-bottom: 4px;
    padding-bottom: 3px;
}

.preview-invoice .party-name {
    font-size: 8px;
    margin-bottom: 2px;
}

.preview-invoice .party p {
    font-size: 6.5px;
    margin: 1px 0;
}

.preview-invoice .info-table td {
    padding: 3px 6px;
    font-size: 6.5px;
}

.preview-invoice .items-table thead th {
    font-size: 6px;
    padding: 4px 5px;
}

.preview-invoice .items-table tbody td {
    font-size: 6.5px;
    padding: 4px 5px;
}

.preview-invoice .totals-table td {
    font-size: 7px;
    padding: 2px 5px;
}

.preview-invoice .grand-total .total-label {
    font-size: 8px;
}

.preview-invoice .grand-total .total-value {
    font-size: 10px;
}

.preview-invoice .qr-code {
    width: 60px;
    height: 60px;
}

.preview-invoice .qr-label {
    font-size: 5px;
}

.preview-invoice .invoice-footer p {
    font-size: 5px;
}

/* === TISKOVÁ VERZE === */
@media print {
    .invoice-pdf,
    .preview-invoice.invoice-pdf {
        font-size: 10pt;
        padding: 0;
        border: none;
        min-height: auto;
    }

    .preview-invoice .invoice-header {
        margin-bottom: 24px;
        padding-bottom: 16px;
        border-bottom: 3px solid #2563eb;
    }

    .invoice-title,
    .preview-invoice .invoice-title {
        font-size: 22pt;
        color: #2563eb !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .preview-invoice .invoice-number {
        font-size: 10pt;
    }

    .preview-invoice .parties {
        gap: 30px;
        margin-bottom: 20px;
    }

    .preview-invoice .party {
        padding: 14px 16px;
    }

    .preview-invoice .party h2 {
        font-size: 8pt;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .preview-invoice .party-name {
        font-size: 11pt;
        margin-bottom: 4px;
    }

    .preview-invoice .party p {
        font-size: 9pt;
        margin: 2px 0;
    }

    .preview-invoice .info-table td {
        padding: 6px 12px;
        font-size: 9pt;
    }

    .preview-invoice .items-table thead th {
        font-size: 8pt;
        padding: 8px 10px;
    }

    .preview-invoice .items-table tbody td {
        font-size: 9pt;
        padding: 8px 10px;
    }

    .preview-invoice .totals-table td {
        font-size: 9pt;
        padding: 4px 10px;
    }

    .preview-invoice .grand-total .total-label {
        font-size: 11pt;
    }

    .preview-invoice .grand-total .total-value {
        font-size: 14pt;
    }

    .preview-invoice .qr-code {
        width: 120px;
        height: 120px;
    }

    .preview-invoice .qr-label {
        font-size: 7pt;
    }

    .preview-invoice .invoice-footer p {
        font-size: 7pt;
    }

    .items-table thead th {
        background: #1e293b !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .party {
        background: #f8fafc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .qr-section {
        page-break-inside: avoid;
    }
}
