/* ============================================================
   EsnafPOS — Satış (POS) ekranı
   ============================================================ */

.pos {
    width: 100%;
    height: 100%;
    display: grid;
    /* Sağ ödeme paneli ekranla birlikte büyür ama aşırı genişlemez */
    grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 460px);
    gap: 12px;
    padding: 12px;
    overflow: hidden;
    background: var(--bg-base);
}

.pos-left, .pos-right {
    display: flex; flex-direction: column;
    gap: 10px;
    min-height: 0;
    min-width: 0;
}

/* ---------- Üst giriş çubuğu ---------- */
.pos-bar {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.qty-box { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.qty-box button {
    width: 34px; height: 38px; border: 0; background: var(--bg-hover);
    font-size: 19px; font-weight: 700; cursor: pointer; color: var(--text-soft);
}
.qty-box button:hover { background: var(--line); }
.qty-box input {
    width: 62px; height: 38px; border: 0; text-align: center;
    font-size: 16px; font-weight: 800; background: var(--bg-input); color: var(--text);
}
.qty-box input:focus { outline: none; }

.barcode-inp {
    flex: 1; min-width: 190px; height: 38px;
    font-size: 16px; font-weight: 700; letter-spacing: .04em;
    font-variant-numeric: tabular-nums;
}
.barcode-inp::placeholder { font-weight: 500; letter-spacing: normal; }

.price-level { display: flex; gap: 4px; align-items: center; }
.price-level label {
    display: flex; align-items: center; gap: 5px;
    padding: 7px 11px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); cursor: pointer;
    font-weight: 700; font-size: 13px; background: var(--bg-elevated);
}
.price-level label.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.price-level input { display: none; }

/* ---------- Kasa sekmeleri ---------- */
.registers { display: flex; gap: 6px; flex-shrink: 0; }
.reg-tab {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    cursor: pointer; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    position: relative;
}
.reg-tab:hover { background: var(--bg-hover); }
.reg-tab.active {
    background: linear-gradient(135deg, var(--primary-from), var(--primary));
    color: #fff; border-color: transparent;
}
.reg-tab .cnt {
    min-width: 19px; padding: 0 5px; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
}

/* ---------- Sepet ---------- */
.cart-wrap {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex; flex-direction: column;
    min-height: 0;
    box-shadow: var(--shadow-sm);
}
.cart-scroll { flex: 1; overflow-y: auto; }

table.cart { width: 100%; border-collapse: collapse; font-size: 14px; }
table.cart thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--bg-hover);
    padding: 9px 11px;
    font-size: 11px; font-weight: 800; letter-spacing: .05em;
    color: var(--text-soft); text-transform: uppercase;
    border-bottom: 1px solid var(--line);
    text-align: left; white-space: nowrap;
}
table.cart tbody td { padding: 9px 11px; border-bottom: 1px solid var(--line); }
table.cart tbody tr { cursor: pointer; }
table.cart tbody tr:hover { background: var(--bg-hover); }
table.cart tbody tr.sel {
    background: linear-gradient(90deg, rgba(0,0,0,.05), transparent);
    box-shadow: inset 3px 0 0 var(--primary);
}
table.cart .num  { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
table.cart .name { font-weight: 700; }
table.cart .bc   { font-size: 12px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.cart-del {
    width: 26px; height: 26px; border-radius: 7px; border: 0;
    background: var(--err-bg); color: var(--err);
    cursor: pointer; font-weight: 800; line-height: 1;
}
.cart-del:hover { background: var(--err); color: #fff; }

/* ---------- Toplam paneli ---------- */
.total-panel {
    background: linear-gradient(135deg, var(--primary-from), var(--primary));
    color: #fff;
    border-radius: var(--radius);
    padding: 14px 17px;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}
.total-panel .lbl { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; opacity: .7; text-transform: uppercase; }
.total-panel .val { font-size: 38px; font-weight: 900; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.total-panel .sub { display: flex; justify-content: space-between; font-size: 12.5px; opacity: .8; margin-top: 3px; }

/* ---------- Para üstü ---------- */
.cash-panel {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
/* 8 buton — her zaman 4 sütun × 2 satır */
.cash-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 8px; }
.cash-quick button {
    padding: 8px 4px; border: 1px solid var(--line-strong); border-radius: 9px;
    background: var(--bg-elevated); font: inherit; font-weight: 800; font-size: 13px; cursor: pointer;
}
.cash-quick button:hover { background: var(--accent); color: #fff; border-color: transparent; }
.change-line {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line-strong);
}
.change-line .amt { font-size: 23px; font-weight: 900; color: var(--ok); font-variant-numeric: tabular-nums; }

/* ---------- Fonksiyon tuşları ---------- */
.fkeys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; flex-shrink: 0; }
.fkey {
    padding: 11px 6px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-weight: 800; font-size: 12.5px;
    transition: transform .07s, background .12s;
    text-align: center; line-height: 1.25;
}
.fkey:hover  { background: var(--bg-hover); }
.fkey:active { transform: translateY(1px); }
.fkey .ico   { font-size: 17px; }
.fkey .kbd   { font-size: 10px; font-weight: 800; opacity: .55; letter-spacing: .04em; }
.fkey.on     { background: var(--warn); color: #2b1c00; border-color: transparent; }
.fkey.pay-cash { background: var(--ok);   color: #fff; border-color: transparent; }
.fkey.pay-card { background: var(--info); color: #fff; border-color: transparent; }
.fkey.pay-mix  { background: var(--accent); color: #fff; border-color: transparent; }
.fkey.pay-cred { background: #7c3aed; color: #fff; border-color: transparent; }
.fkey.pay-fx   { background: #0d9488; color: #fff; border-color: transparent; }

/* ---------- Döviz ile tahsilat ---------- */
.fx-rate-note {
    background: var(--bg-hover); border: 1px solid var(--line); border-radius: 9px;
    padding: 8px 10px; margin-bottom: 12px; font-size: 12px; line-height: 1.55;
    color: var(--text-soft);
}
.fx-summary {
    border: 1px solid var(--line-strong); border-radius: 11px; padding: 10px 12px;
    background: var(--bg-elevated); margin-bottom: 12px;
}
.fx-summary .row { display: flex; justify-content: space-between; align-items: baseline; padding: 3px 0; }
.fx-summary .row.total {
    margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line-strong); font-weight: 800;
}
.fx-summary .amt { font-size: 22px; font-weight: 900; color: var(--ok); font-variant-numeric: tabular-nums; }
.fkey.danger   { background: var(--err); color: #fff; border-color: transparent; }
.fkey:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Hızlı ürün ızgarası ---------- */
.quick-groups { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.quick-groups .scroller { flex: 1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.quick-groups .scroller::-webkit-scrollbar { display: none; }
.qg-tab {
    padding: 7px 13px; border: 1px solid var(--line-strong); border-radius: 9px;
    background: var(--bg-elevated); font: inherit; font-weight: 700; font-size: 13px;
    cursor: pointer; white-space: nowrap;
}
.qg-tab.active { background: var(--primary); color: #fff; border-color: transparent; }
.qg-arrow {
    width: 30px; height: 32px; border: 1px solid var(--line-strong); border-radius: 9px;
    background: var(--bg-elevated); cursor: pointer; font-weight: 800; flex-shrink: 0;
}

.quick-grid {
    flex: 1;
    display: grid;
    /* Sağ panelin genişliğine göre otomatik sütun sayısı */
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    grid-auto-rows: 1fr;
    gap: 6px;
    overflow-y: auto;
    min-height: 0;
    padding-right: 2px;
}
.quick-cell {
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg-card);
    padding: 7px 6px;
    cursor: pointer;
    display: flex; flex-direction: column; justify-content: space-between;
    text-align: left;
    overflow: hidden;
    min-height: 74px;
    transition: transform .07s, box-shadow .12s;
}
.quick-cell:hover  { box-shadow: var(--shadow); border-color: var(--primary-light); }
.quick-cell:active { transform: scale(.97); }
.quick-cell .price { font-size: 14px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.quick-cell .nm    { font-size: 11.5px; font-weight: 700; line-height: 1.25;
                     display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.quick-cell .stk   { font-size: 10.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.quick-cell.empty-cell { background: var(--bg-hover); border-style: dashed; color: var(--text-mute);
                         align-items: center; justify-content: center; font-size: 12px; }

/* ---------- Arama sonuçları ---------- */
.search-pop {
    position: absolute; z-index: 40;
    left: 0; right: 0; top: calc(100% + 5px);
    background: var(--bg-elevated);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-height: 340px; overflow-y: auto;
}
.search-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; cursor: pointer;
    border-bottom: 1px solid var(--line);
}
.search-row:last-child { border-bottom: 0; }
.search-row:hover, .search-row.hl { background: var(--bg-hover); }
.search-row .nm { font-weight: 700; }
.search-row .meta { font-size: 12px; color: var(--text-mute); }

/* ---------- Alt bilgi çubuğu ---------- */
.pos-foot {
    display: flex; align-items: center; gap: 12px;
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 12.5px; font-weight: 600; color: var(--text-soft);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

/* ---------- Özel durum modu uyarısı ---------- */
.mode-banner {
    padding: 7px 13px; border-radius: var(--radius-sm);
    background: var(--warn); color: #2b1c00;
    font-weight: 800; font-size: 13px;
    display: flex; align-items: center; gap: 9px;
    flex-shrink: 0;
}

/* ---------- Kamera ile barkod okuma ---------- */
.cam-stage {
    position: relative;
    width: 100%;
    min-height: 260px;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    display: grid;
    place-items: center;
}
.cam-stage #esnaf-cam { width: 100%; }
.cam-stage video { width: 100% !important; height: auto !important; display: block; }

/* Tarama çerçevesi — 1D barkoda uygun geniş ve alçak */
.cam-overlay {
    position: absolute; inset: 0;
    pointer-events: none;
    display: grid; place-items: center;
}
.cam-overlay::before {
    content: '';
    width: 88%; height: 38%;
    border: 2px solid rgba(255,255,255,.9);
    border-radius: 10px;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,.35);
}
.cam-line {
    position: absolute;
    width: 84%; height: 2px;
    background: linear-gradient(90deg, transparent, #ff3b30, transparent);
    animation: camScan 1.9s ease-in-out infinite;
}
@keyframes camScan {
    0%, 100% { transform: translateY(-52px); opacity: .5 }
    50%      { transform: translateY(52px);  opacity: 1 }
}

.cam-msg {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; color: #fff; font-weight: 700;
}
.cam-tips {
    margin-top: 10px; padding: 9px 12px;
    background: var(--bg-hover); border-radius: 10px;
    font-size: 12.5px; color: var(--text-soft); text-align: center;
}

/* ---------- Fiş önizleme ---------- */
.receipt-preview {
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 12px; line-height: 1.42;
    white-space: pre-wrap;
    background: #fff; color: #000;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    max-height: 60vh; overflow-y: auto;
}

@media (max-width: 1200px) {
    .pos { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; overflow-y: auto; }
}
@media (max-width: 700px) {
    .pos { padding: 8px; gap: 8px; }
    .quick-grid { grid-template-columns: repeat(3, 1fr); }
    .fkeys { grid-template-columns: repeat(2, 1fr); }
    .pos-bar { padding: 8px; gap: 6px; }
    .barcode-inp { min-width: 140px; }
    .total-panel .val { font-size: 30px; }
}

/* ---------- Veresiye müşteri seçici ---------- */
.cust-picker {
    max-height: 230px; overflow-y: auto; margin-bottom: 10px;
    border: 1px solid var(--line-strong); border-radius: 11px; background: var(--bg-elevated);
}
.cust-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 11px; cursor: pointer;
    border-bottom: 1px solid var(--line);
}
.cust-row:last-child { border-bottom: 0; }
.cust-row:hover { background: var(--bg-hover); }
.cust-row.sel { background: var(--accent); color: #fff; }
.cust-row.sel .meta, .cust-row.sel .text-mute, .cust-row.sel .text-err { color: #fff; opacity: .9; }
.cust-row .nm   { font-weight: 700; }
.cust-row .meta { font-size: 12px; color: var(--text-mute); }
.cust-empty { padding: 18px 12px; text-align: center; color: var(--text-mute); font-size: 13px; }

/* ---------- Kampanya paneli ---------- */
.camp-panel {
    background: var(--ok-bg); border: 1px solid var(--ok); border-radius: 11px;
    padding: 8px 11px; flex-shrink: 0; font-size: 13px;
}
.camp-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.camp-row + .camp-row { border-top: 1px dashed var(--line); }
