/* Kafe programi - dokunmatik arayuz.
   Harici kutuphane yok: kafede internet kesilse de calisir. */

:root {
    /* Sicak kagit tonu, kafe isigi altinda goz yormuyor */
    --bg: #f6f4f0;
    --bg-sunken: #efece6;
    --panel: #ffffff;

    --ink: #1c1917;
    --ink-soft: #44403c;
    --muted: #78716c;
    --faint: #a8a29e;

    --line: #e7e3dc;
    --line-strong: #d6d1c8;

    /* Terracotta - kahve/kiremit tonu, mavi kurumsal klisesinden uzak */
    --brand: #a8451c;
    --brand-hover: #8f3a17;
    --brand-soft: #fdf1ea;
    --brand-ink: #ffffff;

    --ok: #15803d;
    --ok-soft: #eaf6ee;
    --warn: #a16207;
    --warn-soft: #fdf6e3;
    --danger: #b3261e;
    --danger-soft: #fdeeec;

    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(28, 25, 23, .06);
    --shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 10px 24px -14px rgba(28, 25, 23, .22);
    --shadow-lift: 0 2px 4px rgba(28, 25, 23, .06), 0 18px 36px -18px rgba(28, 25, 23, .28);

    --tap: 52px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

button, .tile, .navbar, .cat-tab { -webkit-user-select: none; user-select: none; }
a { color: var(--brand); text-decoration: none; }

/* Para ve adet: rakamlar hizali dursun */
.amount, .l-total, .num, .totals, .pin-display { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Ust bar */

.navbar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 10px 18px;
    position: sticky;
    top: 0;
    z-index: 30;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.navbar .brand {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.015em;
    margin-right: 14px;
    color: var(--ink);
}
.navbar .brand::before {
    content: "";
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--brand);
    margin-right: 8px;
    vertical-align: middle;
}

.navbar .spacer { flex: 1; }

.navbar a {
    padding: 8px 13px;
    border-radius: var(--r-sm);
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 550;
    transition: background .12s ease, color .12s ease;
}
.navbar a:hover { background: var(--bg-sunken); color: var(--ink); }
.navbar a.active { background: var(--ink); color: #fff; }

.navbar .who {
    color: var(--muted);
    font-size: 13px;
    padding: 8px 6px 8px 12px;
    font-weight: 550;
}

.wrap { padding: 22px 18px 48px; max-width: 1440px; margin: 0 auto; }

/* ------------------------------------------------------------- Bildirimler */

.flash {
    padding: 13px 16px;
    border-radius: var(--r);
    margin-bottom: 16px;
    font-weight: 550;
    font-size: 14.5px;
    border: 1px solid transparent;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.flash::before { font-weight: 700; }
.flash.success { background: var(--ok-soft); color: #14532d; border-color: #cfe7d8; }
.flash.success::before { content: "✓"; }
.flash.error { background: var(--danger-soft); color: #7f1d1d; border-color: #f4d2ce; }
.flash.error::before { content: "!"; }
.flash.warning { background: var(--warn-soft); color: #713f12; border-color: #efe0bd; }
.flash.warning::before { content: "!"; }

/* -------------------------------------------------------------- Kart / baslik */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

h1 { font-size: 21px; font-weight: 680; letter-spacing: -.02em; margin: 0 0 16px; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 14px; }
h3 {
    font-size: 11.5px; font-weight: 700; margin: 0 0 10px;
    color: var(--faint); text-transform: uppercase; letter-spacing: .08em;
}
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- Masa plani */

.area-title {
    margin: 26px 0 12px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: .1em;
    display: flex;
    align-items: center;
    gap: 12px;
}
.area-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}
.area-title:first-child { margin-top: 4px; }

.grid-tables {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 14px;
}

.tile {
    position: relative;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px 16px 14px;
    min-height: 116px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    width: 100%;
    box-shadow: var(--shadow-sm);
    transition: transform .1s ease, box-shadow .16s ease, border-color .16s ease;
}
.tile:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.tile:active { transform: scale(.985); }
.tile:disabled { opacity: .5; cursor: not-allowed; }

.tile .name { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.tile .meta { color: var(--muted); font-size: 12.5px; }
.tile .amount { margin-top: auto; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.tile .amount.muted { font-weight: 550; font-size: 14px; }

/* Dolu masa: sol kenarda renk seridi + hafif zemin */
.tile.busy {
    background: linear-gradient(180deg, var(--brand-soft), #fff 70%);
    border-color: #f0d9cc;
}
.tile.busy::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--brand);
}
.tile.busy .amount { color: var(--brand); }

/* ------------------------------------------------------------ Adisyon ekrani */

.order-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 940px) {
    .order-layout { grid-template-columns: 1fr; }
    .ticket { position: static !important; }
}

.cat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 2px;
}
.cat-tab {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink-soft);
    border-radius: 999px;
    padding: 9px 17px;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    min-height: 42px;
    box-shadow: var(--shadow-sm);
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.cat-tab:hover { border-color: var(--line-strong); }
.cat-tab.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.grid-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
    gap: 11px;
}

.prod {
    min-height: 78px;
    padding: 13px 14px;
    border-radius: var(--r);
    border: 1px solid var(--line);
    background: var(--panel);
    cursor: pointer;
    font: inherit;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    box-shadow: var(--shadow-sm);
    transition: transform .1s ease, box-shadow .16s ease, border-color .16s ease;
}
.prod:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.prod:active { transform: scale(.98); }
.prod .p-name { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.prod .p-price { color: var(--muted); font-size: 13px; font-weight: 550; }

/* ------------------------------------------------------------------ Adisyon */

.ticket {
    position: sticky;
    top: 78px;
    box-shadow: var(--shadow);
    padding: 18px;
}
.ticket .lines {
    max-height: 44vh;
    overflow-y: auto;
    margin: 0 -4px 14px;
    padding: 0 4px;
}

.line {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}
.line:last-child { border-bottom: 0; }
.line .l-name { flex: 1; min-width: 0; font-weight: 550; font-size: 14.5px; }
.line .l-name small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 450;
    margin-top: 1px;
}
.line .l-total { font-weight: 650; min-width: 76px; text-align: right; font-size: 14.5px; }
.line.treat { background: linear-gradient(90deg, var(--ok-soft), transparent 60%); }
.line.treat .l-name { color: var(--ok); }
.line.treat .l-total { text-decoration: line-through; color: var(--faint); }

.totals {
    border-top: 1px solid var(--line-strong);
    padding-top: 12px;
    font-size: 14px;
}
.totals .row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: var(--ink-soft);
}
.totals .row.big {
    font-size: 24px;
    font-weight: 720;
    letter-spacing: -.025em;
    color: var(--ink);
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid var(--line);
    align-items: baseline;
}
.totals .row.big span:first-child {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: .08em;
}

details > summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+ "; }
details[open] > summary::before { content: "− "; }

/* ---------------------------------------------------------------- Butonlar */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--panel);
    font: inherit;
    font-weight: 600;
    font-size: 14.5px;
    cursor: pointer;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transition: transform .1s ease, box-shadow .16s ease, background .12s ease, border-color .12s ease;
    white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { background: #126b34; border-color: #126b34; }
.btn.danger { background: var(--panel); border-color: #eccbc7; color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #e3b6b1; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--bg-sunken); border-color: transparent; box-shadow: none; color: var(--ink); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn.icon { min-width: 38px; padding: 5px 9px; font-size: 16px; font-weight: 700; }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------------------- Form */

label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 5px;
    font-weight: 650;
    letter-spacing: .01em;
}
input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: #fff;
    font: inherit;
    font-size: 14.5px;
    color: var(--ink);
    transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, select:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(168, 69, 28, .13);
}
input[type="color"] { padding: 4px; min-height: 40px; }
input[type="checkbox"] { min-height: auto; box-shadow: none; accent-color: var(--brand); }

.field { margin-bottom: 14px; }
.form-row { display: flex; gap: 11px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1; min-width: 132px; margin-bottom: 0; }
.form-row + .form-row { margin-top: 14px; }

/* ------------------------------------------------------------------ Tablo */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg); }
th {
    font-size: 11px;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 700;
    border-bottom-color: var(--line-strong);
}
td.num, th.num { text-align: right; }
tfoot th { border-top: 1px solid var(--line-strong); color: var(--ink); font-size: 13px; text-transform: none; letter-spacing: 0; }
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* Tablo icindeki duzenleme alanlari daha derli toplu */
td input, td select { min-height: 38px; padding: 6px 9px; font-size: 13.5px; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .01em;
    background: var(--bg-sunken);
    color: var(--muted);
}
.badge.ok { background: var(--ok-soft); color: #14532d; }
.badge.warn { background: var(--warn-soft); color: #854d0e; }
.badge.danger { background: var(--danger-soft); color: #991b1b; }

/* ------------------------------------------------------------ Giris ekrani */

.login-wrap { max-width: 372px; margin: 9vh auto; }
.login-wrap .card { padding: 26px; box-shadow: var(--shadow-lift); border-radius: 20px; }
.login-wrap h1 {
    font-size: 24px;
    margin-bottom: 4px;
    letter-spacing: -.025em;
}
.login-wrap h1::after {
    content: "Personel girisi";
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0;
    margin-top: 3px;
}
.login-wrap form { margin-top: 20px; }

.pin-display {
    font-size: 26px;
    letter-spacing: 14px;
    text-align: center;
    padding: 16px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r);
    background: var(--bg);
    min-height: 62px;
    color: var(--brand);
    text-indent: 14px;
}
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.pin-pad .btn { min-height: 58px; font-size: 20px; font-weight: 650; }

/* ------------------------------------------------------------------ Yazdir */

@media print {
    .navbar, .btn, .btn-row, .no-print { display: none !important; }
    body { background: #fff; font-size: 12px; }
    .wrap { padding: 0; max-width: none; }
    .card { border: 0; padding: 0 0 14px; box-shadow: none; margin-bottom: 8px; break-inside: avoid; }
    h1 { font-size: 16px; }
    table { font-size: 11.5px; }
}
