/* Fiş önizleme + yazdırma (E13).
   Ekranda termal fiş görünümü; @media print ile yalnız fiş kâğıdı basılır. */

.receipt-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 20, 32, .52);
    display: grid;
    place-items: center;
    padding: 24px;
}

.receipt-modal {
    display: flex;
    flex-direction: column;
    width: min(400px, 94vw);
    max-height: 92vh;
    background: #fff;
    border: 1px solid #bbb8af;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .38);
    overflow: hidden;
}

.receipt-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #e4e1d9;
}

.receipt-modal-head h2 {
    margin: 2px 0 0;
    font-size: 18px;
    color: #0f1b2d;
}

.receipt-modal-head > button {
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: #77746d;
    cursor: pointer;
}

/* Kâğıt: kaydırılabilir, hafif dokulu arka plan */
.receipt-paper {
    overflow: auto;
    padding: 18px 16px;
    background: repeating-linear-gradient(#faf9f5, #faf9f5 22px, #f4f2ea 22px, #f4f2ea 23px);
    display: flex;
    justify-content: center;
}

.receipt-doc {
    width: 100%;
    max-width: 300px;
    font-family: "Consolas", "Menlo", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #1c1b18;
    background: #fff;
    padding: 16px 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .10);
}

.receipt-store {
    text-align: center;
    margin-bottom: 4px;
}

.receipt-store-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #0f1b2d;
}

.receipt-store-line {
    display: block;
    font-size: 10.5px;
    color: #6b6a66;
}

.receipt-sep {
    border-top: 1px dashed #b9b6ad;
    margin: 9px 0;
}

.receipt-meta {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.receipt-meta > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.receipt-meta dt {
    color: #6b6a66;
}

.receipt-meta dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

.receipt-item {
    margin-bottom: 7px;
}

.receipt-item-name {
    font-weight: 700;
}

.receipt-item-meta {
    font-size: 10.5px;
    color: #8a8880;
}

.receipt-item-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-variant-numeric: tabular-nums;
}

.receipt-item-row strong {
    font-weight: 700;
}

.receipt-item-row.struck {
    text-decoration: line-through;
    opacity: .55;
    font-size: 11px;
}

.receipt-item-row.faded,
.receipt-total-row.faded {
    opacity: .7;
    font-size: 11px;
}

.receipt-item-return {
    font-size: 10.5px;
    color: #b93434;
}

.receipt-totals,
.receipt-payments,
.receipt-loyalty {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.receipt-loyalty-title {
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .04em;
    margin-bottom: 2px;
}

.receipt-total-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-variant-numeric: tabular-nums;
}

.receipt-grand {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin: 5px 0 2px;
    padding-top: 5px;
    border-top: 1px solid #1c1b18;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.receipt-grand strong {
    font-size: 17px;
    color: #0f1b2d;
}

.receipt-footer-note {
    text-align: center;
    font-style: italic;
    color: #4f4e4a;
    margin-bottom: 6px;
}

.receipt-training {
    text-align: center;
    font-size: 9.5px;
    letter-spacing: .12em;
    color: #9a9890;
}

.receipt-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e4e1d9;
    background: #fbfaf7;
}

.receipt-modal-actions button,
.receipt-modal-actions a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.receipt-btn-print {
    border: 0;
    background: #185fa5;
    color: #fff;
}

.receipt-btn-print:hover {
    background: #14508c;
}

.receipt-btn-close {
    border: 1px solid #cbc8bf;
    background: #fff;
    color: #44433f;
}

.receipt-modal-actions a {
    border: 1px solid #cbc8bf;
    background: #fff;
    color: #185fa5;
    margin-right: auto;
}

/* Aksiyon çubuğunda buton yerine bilgi notu (ör. tümü iade edilmiş fiş) */
.receipt-action-note {
    margin-right: auto;
    color: #8a8880;
    font-size: 12px;
}

/* Ayarlar → Fiş Önizle butonu (fiş alt yazısı textarea'sının altında) */
.settings-preview-btn {
    margin-top: 10px;
}

/* ── Yazdırma: yalnız açık fişi bas ──
   Fişi İÇERMEYEN her öğeyi akıştan tamamen çıkar (display:none): böylece fişten
   ne önce ne sonra boş sayfa kalır ve fiş normal akışta sayfa başından basılır
   (position:absolute kullanmadığımız için transform'lu/relative bir ata da sorun
   çıkarmaz). Fişin ata zinciri (onu saran öğeler) kalır ama süslerinden arınır.
   Kapsam :has(.receipt-print-area) ile fiş açıkken sınırlıdır; fiş kapalıyken
   sıradan sayfa yazdırma hiç etkilenmez.
   Not: :has()/karmaşık :not() modern (evergreen) tarayıcı gerektirir. */
@media print {
    @page {
        size: 80mm auto;
        margin: 5mm;
    }

    body:has(.receipt-print-area) {
        background: #fff !important;
    }

    /* Fişi içermeyen + fiş olmayan + fiş içinde olmayan her öğeyi kaldır. */
    body:has(.receipt-print-area)
        *:not(:has(.receipt-print-area)):not(.receipt-print-area):not(.receipt-print-area *) {
        display: none !important;
    }

    /* Fişi saran ata zincirini kabuk süslerinden (arka plan/kenarlık/gölge/kısıt)
       arındır ki yalnız fiş kâğıdı görünsün. */
    body:has(.receipt-print-area) :has(.receipt-print-area) {
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        background: none !important;
        box-shadow: none !important;
        max-width: none !important;
        max-height: none !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        display: block !important;
    }

    .receipt-print-area {
        max-width: none !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .receipt-doc {
        max-width: none;
        box-shadow: none !important;
        padding: 0 !important;
    }
}
