/* SONAX Tokat - Oto Yıkama Takip Sistemi */

:root {
  --brand:        #1553c7;
  --brand-dark:   #0f3d94;
  --brand-light:  #e8f0ff;
  --accent:       #ff7a00;
  --accent-light: #fff2e5;
  --ok:           #12905a;
  --ok-light:     #e6f6ee;
  --warn:         #b8860b;
  --warn-light:   #fff8e1;
  --danger:       #c62828;
  --danger-light: #fdecec;

  --ink:      #16202e;
  --ink-soft: #5a6b80;
  --line:     #dde4ec;
  --bg:       #f2f5f9;
  --card:     #ffffff;

  --radius:   14px;
  --radius-s: 9px;
  --shadow:   0 1px 2px rgba(16,32,56,.06), 0 6px 20px rgba(16,32,56,.07);
  --touch:    52px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

/* ---------- Üst çubuk ---------- */
.topbar {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .logo {
  display: flex; align-items: center; min-width: 0;
  font-weight: 800; font-size: 1.15rem; letter-spacing: .5px; color: #fff;
}
.topbar .logo:hover { text-decoration: none; }
.logo-mark {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  background: #fff; color: var(--brand);
  display: grid; place-items: center; font-size: 1.2rem; font-weight: 900;
}
.topbar .slogan { font-size: .78rem; opacity: .8; font-weight: 400; display: block; letter-spacing: 0; }
.topbar .spacer { flex: 1; }
.topbar .who { flex: 0 0 auto; font-size: .88rem; opacity: .92; text-align: right; line-height: 1.25; }
.topbar .who strong { display: block; }
.btn-out {
  flex: 0 0 auto;
  background: rgba(255,255,255,.16); color: #fff; border: 0;
  padding: 10px 14px; border-radius: var(--radius-s); cursor: pointer; font-size: .9rem;
}
.btn-out:hover { background: rgba(255,255,255,.28); }

/* Eski Android WebView'lerinde (Chrome < 84) flex "gap" desteklenmez;
   bu yüzden esnek kutularda boşluk kardeş kenar boşluklarıyla verilir. */
.topbar > * + *       { margin-left: 14px; }
.topbar .logo > * + * { margin-left: 12px; }
.page-head > * + *    { margin-left: 12px; }
.card-title > * + *   { margin-left: 10px; }
.free-banner > * + *  { margin-left: 16px; }
.alert > * + *        { margin-left: 10px; }
.hit > * + *          { margin-left: 14px; }
.nav a + a            { margin-left: 4px; }

/* ---------- Menü ---------- */
.nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; padding: 6px 10px;
  overflow-x: auto; position: sticky; top: 58px; z-index: 35;
}
.nav a {
  white-space: nowrap; padding: 11px 16px; border-radius: var(--radius-s);
  color: var(--ink-soft); font-weight: 600; font-size: .95rem;
}
.nav a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--brand); color: #fff; }

/* ---------- Yerleşim ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 18px 14px 60px; }
.page-head {
  display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 16px;
}
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }

/* ---------- Kart ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card.tight { padding: 12px; }
.card h2, .card h3 { margin-top: 0; }
.card-title {
  display: flex; align-items: center; margin: -4px 0 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.card-title h2, .card-title h3 { margin: 0; }
.card-title .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--touch); padding: 12px 20px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: #fff; color: var(--ink); font-size: 1rem; font-weight: 600;
  cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.94); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { filter: brightness(.94); }
.btn-danger { background: #fff; border-color: #f0c2c2; color: var(--danger); }
.btn-danger:hover { background: var(--danger-light); }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .88rem; }
.btn-lg { min-height: 62px; padding: 14px 28px; font-size: 1.12rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; margin: 0 -10px -10px 0; }
.btn-row > * { margin: 0 10px 10px 0; }

/* ---------- Form ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .9rem; color: var(--ink-soft); margin-bottom: 5px; }
.field .hint { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; }
input[type=text], input[type=password], input[type=tel], input[type=number],
input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: var(--touch);
  padding: 11px 13px; font-size: 1rem; font-family: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light);
}
.inline { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 0 -10px -10px 0; }
.inline > * { margin: 0 10px 10px 0; }
.inline .field { margin-bottom: 0; }
.check { display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; margin-right: 9px; accent-color: var(--brand); }

/* ---------- Plaka ---------- */
.plate-input {
  font-size: 2rem !important; font-weight: 800; letter-spacing: 3px;
  text-align: center; text-transform: uppercase; min-height: 76px !important;
  font-family: "Segoe UI", system-ui, sans-serif;
}
.plate {
  display: inline-flex; align-items: stretch; border: 2px solid #1a1a1a;
  border-radius: 6px; overflow: hidden; background: #fff;
  font-weight: 800; letter-spacing: 1px; line-height: 1;
}
.plate .tr {
  background: #0b48c4; color: #fff; padding: 6px 5px; font-size: .55em;
  display: grid; place-items: center; letter-spacing: 0;
}
.plate .no { padding: 7px 12px; color: #111; font-size: 1em; white-space: nowrap; }
.plate.big { font-size: 1.9rem; }
.plate.mid { font-size: 1.15rem; }
.plate.sm  { font-size: .92rem; }

/* ---------- Rozetler ---------- */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 100px;
  font-size: .8rem; font-weight: 700; background: var(--bg); color: var(--ink-soft);
}
.badge.ok     { background: var(--ok-light);     color: var(--ok); }
.badge.warn   { background: var(--warn-light);   color: var(--warn); }
.badge.danger { background: var(--danger-light); color: var(--danger); }
.badge.brand  { background: var(--brand-light);  color: var(--brand-dark); }
.badge.accent { background: var(--accent-light); color: #c25e00; }

/* ---------- Sadakat ---------- */
.loyalty { border-radius: var(--radius); padding: 16px; background: var(--brand-light); border: 1px solid #cfe0ff; }
.loyalty.ready { background: linear-gradient(135deg, #fff6e9, #ffe9cc); border-color: #ffcb8a; }
.loyalty .big-num { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--brand-dark); }
.loyalty.ready .big-num { color: #c25e00; }
.loyalty .cap { font-size: .85rem; color: var(--ink-soft); font-weight: 600; }

.stamps { display: flex; flex-wrap: wrap; margin: 12px -3px 0; }
.stamp {
  flex: 0 0 auto; width: 30px; height: 30px; margin: 3px;
  border-radius: 50%; display: grid; place-items: center;
  border: 2px dashed #b9cdf2; color: #b9cdf2; font-weight: 800; font-size: .85rem; background: #fff;
}
.stamp.on { border-style: solid; border-color: var(--brand); background: var(--brand); color: #fff; }
.stamp.gift { border-color: var(--accent); background: var(--accent); color: #fff; border-style: solid; }

.progress { height: 12px; border-radius: 100px; background: #fff; overflow: hidden; border: 1px solid #cfe0ff; margin-top: 12px; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 100px; }
.loyalty.ready .progress > i { background: var(--accent); }

.free-banner {
  background: linear-gradient(135deg, #ff8a00, #ff5e3a); color: #fff;
  padding: 18px 20px; border-radius: var(--radius); margin-bottom: 16px;
  display: flex; align-items: center; box-shadow: 0 8px 24px rgba(255,110,40,.32);
}
.free-banner .gift { font-size: 2.4rem; line-height: 1; }
.free-banner h2 { margin: 0 0 2px; font-size: 1.3rem; }
.free-banner p { margin: 0; opacity: .95; font-size: .95rem; }

/* ---------- İstatistik kutuları ---------- */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .k { font-size: .82rem; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.stat .v { font-size: 1.85rem; font-weight: 800; line-height: 1.15; margin-top: 4px; }
.stat .s { font-size: .82rem; color: var(--ink-soft); margin-top: 2px; }
.stat.brand  { border-left: 4px solid var(--brand); }
.stat.ok     { border-left: 4px solid var(--ok); }
.stat.accent { border-left: 4px solid var(--accent); }
.stat.warn   { border-left: 4px solid var(--warn); }

/* ---------- Tablo ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.tbl th, table.tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl th { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); background: #f7f9fc; white-space: nowrap; }
table.tbl tbody tr:hover { background: #f9fbfe; }
table.tbl td.num, table.tbl th.num { text-align: right; white-space: nowrap; }
table.tbl tfoot td { font-weight: 700; background: #f7f9fc; }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* ---------- Uyarı mesajları ---------- */
.alert {
  padding: 13px 16px; border-radius: var(--radius-s); margin-bottom: 12px;
  font-weight: 600; border: 1px solid transparent; display: flex; align-items: flex-start;
}
.alert.success { background: var(--ok-light);     color: #0b6b43; border-color: #b9e3ce; }
.alert.error   { background: var(--danger-light); color: #9c1f1f; border-color: #f2c4c4; }
.alert.info    { background: var(--brand-light);  color: var(--brand-dark); border-color: #c9dbff; }
.alert.warn    { background: var(--warn-light);   color: #8a6100; border-color: #f0dfa8; }

.empty { text-align: center; padding: 42px 20px; color: var(--ink-soft); }
.empty .icon { font-size: 3rem; opacity: .35; display: block; margin-bottom: 8px; }

/* ---------- Karşılama ekranı ---------- */
.kiosk-search { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); border-radius: var(--radius); padding: 26px; color: #fff; margin-bottom: 18px; }
.kiosk-search h2 { color: #fff; margin: 0 0 6px; font-size: 1.35rem; }
.kiosk-search p { margin: 0 0 16px; opacity: .85; font-size: .95rem; }
.kiosk-search .row { display: flex; flex-wrap: wrap; margin: 0 -10px -10px 0; }
.kiosk-search .row > * { margin: 0 10px 10px 0; }
.kiosk-search .row > form { flex: 1; min-width: 280px; display: flex; }
.kiosk-search .row > form > * + * { margin-left: 10px; }
.kiosk-search input { flex: 1; }

.result-head { display: flex; align-items: center; flex-wrap: wrap; margin: 0 -18px -10px 0; }
.result-head > * { margin: 0 18px 10px 0; }
.result-head .who h2 { margin: 0 0 2px; font-size: 1.5rem; }

.hit-list { display: grid; gap: 10px; }
.hit {
  display: flex; align-items: center; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff;
}
.hit:hover { border-color: var(--brand); text-decoration: none; }
.hit .spacer { flex: 1; }

/* ---------- Hizmet seçim kutuları ---------- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.svc {
  border: 2px solid var(--line); border-radius: var(--radius); padding: 14px;
  cursor: pointer; background: #fff; position: relative; user-select: none;
}
.svc:hover { border-color: #b9cdf2; }
.svc.sel { border-color: var(--brand); background: var(--brand-light); }
.svc.free { border-color: var(--accent); background: var(--accent-light); }
.svc .nm { font-weight: 700; margin-bottom: 4px; }
.svc .pr { font-size: 1.15rem; font-weight: 800; color: var(--brand-dark); }
.svc.free .pr { color: #c25e00; text-decoration: line-through; opacity: .6; }
.svc .pt { font-size: .82rem; color: var(--ink-soft); }
.svc .tick { position: absolute; top: 10px; right: 10px; font-size: 1.1rem; opacity: 0; }
.svc.sel .tick, .svc.free .tick { opacity: 1; }
.svc .freebtn {
  margin-top: 10px; width: 100%; border: 1px dashed var(--accent); color: #c25e00;
  background: #fff; border-radius: var(--radius-s); padding: 7px; font-size: .85rem;
  font-weight: 700; cursor: pointer; font-family: inherit;
}
.svc.free .freebtn { background: var(--accent); color: #fff; border-style: solid; }

.summary-box { position: sticky; top: 120px; }
.sum-row { display: flex; justify-content: space-between; padding: 7px 0; }
.sum-row.total { border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 12px; font-size: 1.3rem; font-weight: 800; }

/* ---------- Grafik ---------- */
.bars { display: flex; align-items: flex-end; height: 150px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; margin: 0 3px; }
.bars .b > * + * { margin-top: 5px; }
.bars .b i { display: block; width: 100%; background: var(--brand); border-radius: 5px 5px 0 0; min-height: 3px; opacity: .85; }
.bars .b:hover i { opacity: 1; }
.bars .b span { font-size: .68rem; color: var(--ink-soft); white-space: nowrap; }

/* ---------- Fiş ---------- */
.receipt { max-width: 340px; margin: 20px auto; background: #fff; padding: 18px; font-family: "Consolas", "Courier New", monospace; font-size: 13px; color: #000; }
.receipt h1 { text-align: center; font-size: 17px; margin: 0 0 2px; }
.receipt .c { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 10px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt td.r { text-align: right; white-space: nowrap; }

@media print {
  .no-print, .topbar, .nav { display: none !important; }
  body { background: #fff; }
  .receipt { margin: 0; max-width: none; }
}

/* ---------- Giriş ekranı ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, #0f3d94, #1553c7 55%, #2a7de1);
}
.login-box { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 32px 28px; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.login-box .brand { text-align: center; margin-bottom: 22px; }
.login-box .brand .logo-mark { width: 62px; height: 62px; margin: 0 auto 12px; font-size: 1.7rem; background: var(--brand); color: #fff; }
.login-box h1 { font-size: 1.35rem; margin: 0; text-align: center; }
.login-box .sub { text-align: center; color: var(--ink-soft); font-size: .9rem; margin: 2px 0 0; }

/* ---------- Duyarlı ---------- */
@media (max-width: 1000px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: 1fr; }
  .summary-box { position: static; }
}
@media (max-width: 720px) {
  .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
  .wrap { padding: 14px 10px 50px; }
  .topbar { top: 0; }
  .nav { top: 62px; }
  .plate-input { font-size: 1.6rem !important; min-height: 66px !important; }
  .topbar .who { display: none; }
}
@media (max-width: 460px) {
  .grid.c4 { grid-template-columns: 1fr; }
}
