/* =========================================================
   Nur Patisserie · Yönetim Paneli
   Sıcak, sade ve kasiyer kullanımına uygun arayüz.
   ========================================================= */
:root {
    --brand:        #8e3b60;   /* patisserie bordo/gül */
    --brand-dark:   #6d2b4a;
    --brand-soft:   #f6eef2;
    --accent:       #c98a2b;   /* karamel */
    --bg:           #f4f2f4;
    --card:         #ffffff;
    --ink:          #2a2430;
    --muted:        #7c7484;
    --line:         #e7e2ea;
    --ok:           #2e7d52;
    --warn:         #b8860b;
    --danger:       #c0392b;
    --sidebar-w:    248px;
    --radius:       12px;
    --shadow:       0 1px 3px rgba(40,25,45,.06), 0 6px 20px rgba(40,25,45,.05);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
}

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main  { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sidebar-w); }

/* ---------- Sidebar ---------- */
.app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--brand-dark), var(--brand));
    color: #fff; display: flex; flex-direction: column; z-index: 1040;
    overflow: hidden;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px; font-size: 18px; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand i { font-size: 22px; color: #ffd9a8; }
.sidebar-nav { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.sidebar-foot { margin-top: auto; padding: 14px 12px 16px; text-align: center; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-foot img { opacity: .8; transition: opacity .15s; }
.sidebar-foot a:hover img { opacity: 1; }
.nav-section {
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: rgba(255,255,255,.5); padding: 14px 10px 6px;
}
.sidebar-nav .nav-link {
    color: rgba(255,255,255,.86); border-radius: 8px; padding: 9px 12px;
    display: flex; align-items: center; gap: 10px; font-size: 14.5px;
    transition: background .15s, color .15s;
}
.sidebar-nav .nav-link i { width: 20px; text-align: center; font-size: 16px; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar-nav .nav-link.active { background: #fff; color: var(--brand-dark); font-weight: 600; }
.sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035;
}

/* ---------- Topbar ---------- */
.topbar {
    background: var(--card); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px; padding: 10px 20px;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; font-size: 16px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

/* ---------- Content ---------- */
.app-content { padding: 20px; flex: 1; }
.app-footer  { padding: 12px 20px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
.page-head   { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 700; }
.page-head .spacer { flex: 1; }

/* ---------- Cards / Stats ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.stat-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-card .icon  { position: absolute; right: 14px; top: 14px; font-size: 26px; color: var(--brand-soft); }
.stat-card.accent .value { color: var(--brand); }

/* ---------- Tables ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
table.data thead th { background: #faf8fb; font-weight: 600; color: var(--ink); cursor: pointer; user-select: none; white-space: nowrap; }
table.data tbody tr:hover { background: #fcfbfd; }
table.data tfoot td { font-weight: 700; background: #faf8fb; }
.badge-soft { padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge-ok     { background: #e5f4ec; color: var(--ok); }
.badge-warn   { background: #fdf3dd; color: var(--warn); }
.badge-danger { background: #fbe9e7; color: var(--danger); }
.badge-info   { background: #e8eefc; color: #2f5bd0; }
.badge-muted  { background: #eee; color: #666; }

/* ---------- Buttons ---------- */
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-outline-brand { border-color: var(--brand); color: var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }

/* =========================================================
   POS - Sıcak Satış / Dış Sipariş ekranı
   ========================================================= */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 16px; height: calc(100vh - 132px); }
.pos-left, .pos-right {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
}
.pos-toolbar { padding: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.cat-chips { padding: 10px 12px; display: flex; gap: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.cat-chip {
    white-space: nowrap; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--line);
    background: #fff; cursor: pointer; font-size: 13.5px; color: var(--ink);
}
.cat-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.product-grid {
    padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px; overflow-y: auto; flex: 1; align-content: start;
}
.product-card {
    border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer;
    background: #fff; transition: transform .08s, box-shadow .12s, border-color .12s;
    display: flex; flex-direction: column; gap: 6px; min-height: 92px; user-select: none;
}
.product-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.product-card:active { transform: scale(.98); }
.product-card .p-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.product-card .p-price { margin-top: auto; color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; }
.product-card .p-img { height: 64px; border-radius: 8px; object-fit: cover; width: 100%; background: var(--brand-soft); }

/* Sağ panel - sepet */
.pos-right-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pos-target-select { width: 100%; }
.cart-lines { flex: 1; overflow-y: auto; padding: 6px 10px; }
.cart-line {
    border-bottom: 1px dashed var(--line); padding: 8px 4px; display: flex; flex-direction: column; gap: 4px;
}
.cart-line .line-top { display: flex; align-items: center; gap: 8px; }
.cart-line .l-name { font-weight: 600; font-size: 14px; flex: 1; }
.cart-line .l-total { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 84px; text-align: right; }
.qty-box { display: flex; align-items: center; gap: 0; }
.qty-box button {
    width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 6px;
    cursor: pointer; font-weight: 700; line-height: 1;
}
.qty-box input { width: 42px; text-align: center; border: 1px solid var(--line); height: 28px; margin: 0 4px; border-radius: 6px; }
.cart-line .line-actions { display: flex; gap: 10px; font-size: 12px; }
.cart-line .line-actions a { color: var(--muted); cursor: pointer; text-decoration: none; }
.cart-line .line-actions a:hover { color: var(--brand); }
.line-note { font-size: 12px; color: var(--muted); font-style: italic; }

.cart-summary { border-top: 1px solid var(--line); padding: 12px 14px; background: #faf8fb; }
.cart-summary .row-line { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.cart-summary .grand { font-size: 20px; font-weight: 800; color: var(--brand); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.cart-actions { padding: 12px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cart-actions .btn { padding: 12px; font-weight: 600; }
.empty-cart { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand)); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%; max-width: 400px; padding: 34px 30px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand i { font-size: 40px; color: var(--brand); }
.login-brand h1 { font-size: 22px; margin: 8px 0 2px; }
.login-brand p { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------- Utilities ---------- */
.text-money { font-variant-numeric: tabular-nums; }
.filter-bar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr 340px; } }
@media (max-width: 992px) {
    .app-main { margin-left: 0; }
    .app-sidebar { transform: translateX(-100%); transition: transform .2s; }
    .app-sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; }
    .pos { grid-template-columns: 1fr; height: auto; }
    /* Mobilde flex:1 yüksekliği sıfıra çökebiliyor; ürün ızgarasını sınırlı-kaydırılabilir yap */
    .product-grid { flex: none; max-height: 42vh; overflow-y: auto;
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .cart-lines { flex: none; overflow: visible; }
    .pos-right { position: static; }
}

/* Kısa yükseklikli ekranlar (laptop): sağ paneli tek parça kaydır, sepet listesi doğal yükseklikte aksın */
@media (min-width: 993px) and (max-height: 820px) {
    .pos-right { overflow-y: auto; }
    .cart-lines { flex: none; overflow: visible; min-height: 90px; }
}

/* ---------- Cards (header/body) ---------- */
.card-header { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600;
    color: var(--ink); background: var(--brand-soft); border-radius: var(--radius) var(--radius) 0 0; }
.card-body { padding: 16px; }

/* ---------- Status dot ---------- */
.status-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%;
    background: var(--muted); box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.status-dot.ok { background: var(--ok); }
.status-dot.danger { background: var(--danger); }
.status-dot.warn { background: var(--warn); }
.status-dot.muted { background: var(--muted); }

/* ---------- Report KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow); }
.kpi-card .kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.kpi-card .kpi-value { font-size: 24px; font-weight: 700; color: var(--brand-dark); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-card .kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Report tabs ---------- */
.report-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.report-tab { border: 1px solid var(--line); background: var(--card); color: var(--ink);
    padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; }
.report-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.report-tab:hover:not(.active) { background: var(--brand-soft); }

/* ---------- Export buttons ---------- */
.export-bar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Audit/JSON viewer ---------- */
.json-cell { max-width: 340px; }
.json-cell pre { margin: 0; font-size: 11px; max-height: 120px; overflow: auto;
    background: #faf8fb; border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
