/* Pexus GO — mobil öncelikli premium panel (13_MOBILE_WEB_UX.md) */

:root {
  --gold: #c9a84c;
  --gold-soft: #e2c97a;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --shell-max: 1180px;
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Koyu tema — antrasit + koyu mermer + şampanya altını */
:root,
:root[data-theme='dark'] {
  --bg: #14161a;
  --bg-marble:
    radial-gradient(900px 500px at 12% -10%, rgba(201, 168, 76, 0.10), transparent 60%),
    radial-gradient(700px 420px at 105% 8%, rgba(255, 255, 255, 0.045), transparent 62%),
    linear-gradient(160deg, #14161a 0%, #1a1d22 48%, #101215 100%);
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.10);
  --text: #f2efe6;
  --text-dim: #a9a498;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --ok: #56c08a;
  --warn: #dca94c;
  --danger: #e0685f;
  --info: #6fa8d4;
}

/* Açık tema — krem mermer + koyu antrasit yazı + altın detay */
:root[data-theme='light'] {
  --bg: #f6f2ea;
  --bg-marble:
    radial-gradient(900px 500px at 10% -12%, rgba(201, 168, 76, 0.18), transparent 62%),
    radial-gradient(700px 420px at 100% 6%, rgba(255, 255, 255, 0.9), transparent 60%),
    linear-gradient(160deg, #f8f5ee 0%, #efe8dc 52%, #f6f2ea 100%);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.92);
  --border: rgba(38, 34, 28, 0.12);
  --text: #23211d;
  --text-dim: #6d675d;
  --shadow: 0 10px 26px rgba(60, 50, 30, 0.14);
  --ok: #2f8f5f;
  --warn: #a97b16;
  --danger: #b8443c;
  --info: #2f6f9e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-marble);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

a { color: var(--gold); }

/* ── Üst bar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px);
  padding-top: calc(12px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 15px;
  background: linear-gradient(120deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  -webkit-text-fill-color: var(--text-dim);
}

.topbar .spacer { flex: 1; }

.icon-btn {
  min-width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease);
}
.icon-btn:active { transform: scale(0.94); }

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot.warn { background: var(--warn); }
.dot.down { background: var(--danger); }

/* ── Yerleşim ────────────────────────────────────────────────────────── */
main { max-width: var(--shell-max); margin: 0 auto; padding: 16px; }
.page { display: none; animation: fade 0.22s var(--ease); }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2 { font-size: 18px; margin: 4px 0 14px; letter-spacing: 0.02em; }
h3 { font-size: 14px; margin: 20px 0 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.14em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat .label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat .value.gold { color: var(--gold); }

/* ── Liste kartları (küçük ekranda tablo yok) ────────────────────────── */
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 8px;
  min-height: var(--tap);
}
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; font-size: 14px; }
.item .sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; word-break: break-word; }
.item.selected { border-color: var(--gold); background: var(--surface-2); }

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.badge.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }

/* ── Form ve butonlar ────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* iOS zoom engelleme */
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--gold) 55%, transparent);
  outline-offset: 1px;
}
label { display: block; font-size: 12px; color: var(--text-dim); margin: 10px 0 6px; }

.btn {
  min-height: var(--tap);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.14s var(--ease), filter 0.14s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(120deg, var(--gold), var(--gold-soft));
  color: #1a1710;
  border-color: transparent;
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 38px; padding: 8px 12px; font-size: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; min-width: 120px; }

/* ── Alt menü ────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1;
  min-height: 64px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 10px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}
.tabbar button .ico { font-size: 19px; }
.tabbar button.active { color: var(--gold); }

/* ── Yardımcılar ─────────────────────────────────────────────────────── */
.skeleton {
  height: 62px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty { text-align: center; padding: 34px 16px; color: var(--text-dim); font-size: 13px; }
.muted { color: var(--text-dim); font-size: 12px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; }

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  width: min(92vw, 460px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: rise 0.24s var(--ease);
}
.toast.error { border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.offline-banner {
  display: none;
  background: var(--danger);
  color: #fff;
  text-align: center;
  padding: 9px;
  font-size: 12px;
  font-weight: 600;
}
body.offline .offline-banner { display: block; }

/* Giriş ekranı */
.login-wrap { min-height: 78vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: min(420px, 100%); }
.login-card .brand { font-size: 24px; text-align: center; margin-bottom: 4px; }
.login-card .brand small { text-align: center; }

/* Modal */
.modal-host {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-host.open { display: flex; }
.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg);
  background-image: var(--bg-marble);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sheet 0.26s var(--ease);
}
@media (min-width: 720px) {
  .modal-host { align-items: center; }
  .modal { border-radius: 20px; }
}
@keyframes sheet { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }

.qr-box { text-align: center; padding: 10px; }
.qr-box img { width: min(280px, 80vw); border-radius: 12px; background: #fff; padding: 10px; }

.map-canvas {
  position: relative;
  height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    linear-gradient(0deg, transparent 24%, rgba(201, 168, 76, 0.06) 25%, rgba(201, 168, 76, 0.06) 26%, transparent 27%),
    linear-gradient(90deg, transparent 24%, rgba(201, 168, 76, 0.06) 25%, rgba(201, 168, 76, 0.06) 26%, transparent 27%),
    var(--surface);
  background-size: 42px 42px, 42px 42px, auto;
  overflow: hidden;
}
.pin {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent);
  transform: translate(-50%, -50%);
}
.pin.stale { background: var(--text-dim); box-shadow: 0 0 0 4px rgba(150, 150, 150, 0.2); }
.pin .tip {
  position: absolute; left: 14px; top: -6px;
  font-size: 10px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 6px; color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
