/* =============================================================
 * IoT Panel — koyu tema, LVGL ekran tarziyla uyumlu.
 * Vanilla CSS, CDN'siz. Responsive: desktop 3 sutun, tablet 2,
 * telefon 1 sutun (kartlar alt alta).
 * ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
.hidden { display: none !important; }
html {
  -webkit-tap-highlight-color: transparent;
  /* overflow-x: clip horizontal tasmayi gizler ama sticky context'ini
   * BOZMAZ (hidden'in aksine). Sticky'i koruyup yatay overflow'u keser. */
  overflow-x: clip;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- Renk paleti — DARK (default) ---------- */
:root {
  --c-bg:           #0A0E1A;
  --c-card-top:    #1F2540;
  --c-card-bot:    #161B2E;
  --c-card-inset:  rgba(0, 0, 0, 0.3);
  --c-border:      rgba(255, 255, 255, 0.06);
  --c-border-soft: rgba(255, 255, 255, 0.04);
  --c-topbar-bg:   rgba(10, 14, 26, 0.92);
  --c-grid-line:   #1E293B;
  --c-trend-bg:    rgba(0, 0, 0, 0.2);
  --c-shadow:      0 4px 16px rgba(0,0,0,0.25);
  --c-shadow-lg:   0 8px 24px rgba(0,0,0,0.35);
  --c-input-bg:    rgba(0, 0, 0, 0.3);
  --c-input-bg-focus: rgba(0, 0, 0, 0.5);
  --c-hover-overlay: rgba(127, 127, 127, 0.12);

  --c-text:        #F1F5F9;
  --c-label:       #94A3B8;
  --c-dim:         #64748B;

  --c-in:          #F97316;   /* turuncu — ic */
  --c-out:         #06B6D4;   /* cyan   — dis */

  --c-ok:          #10B981;
  --c-warn:        #F59E0B;
  --c-err:         #EF4444;

  --c-relay-off:   #374151;
  --c-relay-on:    #10B981;
}

/* ---------- LIGHT tema override ----------
 * Body tam beyaz, kartlar (neredeyse) beyaz — gradient cok hafif, kontrast
 * BORDER + SHADOW ile saglanir (yuzen kart efekti, modern UI). */
html[data-theme="light"] {
  --c-bg:           #FFFFFF;
  --c-card-top:    #FFFFFF;
  --c-card-bot:    #F8FAFC;              /* cok hafif gri — gradient ipucu */
  --c-card-inset:  rgba(15, 23, 42, 0.04);
  --c-border:      rgba(15, 23, 42, 0.10);
  --c-border-soft: rgba(15, 23, 42, 0.05);
  --c-topbar-bg:   rgba(255, 255, 255, 0.92);
  --c-grid-line:   #E2E8F0;
  --c-trend-bg:    rgba(15, 23, 42, 0.03);
  /* Iki katmanli shadow: yakin (1px) + uzak (yumusak yayilim). Cardlar
   * beyaz body uzerinde net "yuzuyor" gibi gorunur. */
  --c-shadow:      0 1px 2px rgba(15, 23, 42, 0.06),
                    0 4px 16px rgba(15, 23, 42, 0.06);
  --c-shadow-lg:   0 2px 6px rgba(15, 23, 42, 0.08),
                    0 12px 32px rgba(15, 23, 42, 0.10);
  --c-input-bg:    #F8FAFC;
  --c-input-bg-focus: #FFFFFF;
  --c-hover-overlay: rgba(15, 23, 42, 0.06);

  --c-text:        #0F172A;
  --c-label:       #475569;
  --c-dim:         #94A3B8;

  --c-relay-off:   #E2E8F0;
}

body {
  transition: background-color 200ms ease, color 200ms ease;
}

/* ---------- Layout ---------- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
}
.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ---------- Page transition ---------- */
.page { transition: opacity 200ms ease; }
.page.hidden { opacity: 0; pointer-events: none; position: absolute; left: -9999px; }

/* ---------- Top bar — sticky. Eski versiyondaki gibi.
 * Mobile'da horizontal overflow olunca sticky bozulabiliyordu; bunu html'de
 * overflow-x: clip ile çözdük (sticky context korunur, taşma kırpılır). */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--c-topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  transition: background-color 200ms ease;
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.dash-clock {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Rol rozeti — topbar sag'da. Rol bilinmedikce hidden, geldiginde rol renkli. */
.role-badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.role-badge.role-viewer {
  background: rgba(100, 116, 139, 0.18);
  color: var(--c-label);
  border-color: rgba(100, 116, 139, 0.32);
}
.role-badge.role-operator {
  background: rgba(6, 182, 212, 0.16);
  color: var(--c-out);
  border-color: rgba(6, 182, 212, 0.4);
}
.role-badge.role-admin {
  background: rgba(16, 185, 129, 0.16);
  color: var(--c-ok);
  border-color: rgba(16, 185, 129, 0.4);
}

/* Viewer: röleler disabled + opacity dusur. cursor not-allowed. */
.relay-btn[data-role-readonly="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Status dot ---------- */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--c-dim);
  flex-shrink: 0;
}
.status-dot.connected  { background: var(--c-ok); }
.status-dot.connecting { background: var(--c-dim); animation: pulse-soft 2s ease-in-out infinite; }

/* Baglanti kalite seviyeleri (status bar) */
.status-dot.q-excellent { background: #16a34a; }
.status-dot.q-good      { background: #84cc16; }
.status-dot.q-fair      { background: var(--c-warn); }
.status-dot.q-poor      { background: var(--c-in); }
.status-dot.q-offline   { background: var(--c-err);
                          animation: pulse-soft 1.2s ease-in-out infinite; }
.status-dot.q-paused    { background: var(--c-dim); }
.status-dot.q-device-off{ background: var(--c-err); }

.status-text {
  font-size: 12px;
  color: var(--c-label);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.status-text.q-excellent { color: #4ade80; }
.status-text.q-good      { color: #a3e635; }
.status-text.q-fair      { color: var(--c-warn); }
.status-text.q-poor      { color: var(--c-in); }
.status-text.q-offline,
.status-text.q-device-off{ color: var(--c-err); }
.status-text.q-paused    { color: var(--c-dim); }
.status-text .sep { color: var(--c-dim); }
.status-text .last-update {
  color: var(--c-dim);
  font-variant-numeric: tabular-nums;
}

.dev-id {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-link {
  font-size: 18px;
  color: var(--c-label);
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background-color 150ms;
}
.btn-link:hover { background: var(--c-hover-overlay); color: var(--c-text); }

/* Topbar icon butonlari (tema toggle + cikis) — masaustunde rahat
 * tiklanabilir, mobile'da daha kompakt. */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--c-label);
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms, color 150ms;
  padding: 0;
}
.btn-icon:hover {
  background: var(--c-hover-overlay);
  border-color: var(--c-border);
  color: var(--c-text);
}
.btn-icon:active { transform: scale(0.96); }
.btn-icon svg { display: block; }

/* Tema ikonlari — symetric, hem dark hem light explicit set ediliyor.
 * Default (data-theme yok) icin moon goster (dark gibi davransin). */
.theme-icon { display: none; }
.theme-icon-moon { display: block; }            /* fallback / dark */
html[data-theme="dark"]  .theme-icon-moon { display: block; }
html[data-theme="dark"]  .theme-icon-sun  { display: none; }
html[data-theme="light"] .theme-icon-moon { display: none; }
html[data-theme="light"] .theme-icon-sun  { display: block; }

/* ---------- Login card ---------- */
.login-wrap { width: 100%; max-width: 380px; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-emoji { font-size: 60px; margin-bottom: 12px; }
.login-title { font-size: 22px; font-weight: 600; color: var(--c-text); margin: 0; }
.login-subtitle { font-size: 14px; color: var(--c-label); margin-top: 4px; }
.login-card {
  background: linear-gradient(135deg, var(--c-card-top) 0%, var(--c-card-bot) 100%);
  border-radius: 16px;
  border: 1px solid var(--c-border);
  box-shadow: var(--c-shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--c-card-inset);
  border: 1px solid var(--c-border);
  border-radius: 8px;
}
.login-badge .label { font-size: 12px; color: var(--c-label); }
.login-badge .value { font-size: 14px; font-weight: 500; color: var(--c-text); }
.login-error {
  padding: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  font-size: 14px;
  color: var(--c-err);
}
.login-fields { display: flex; flex-direction: column; gap: 12px; }
.login-fields label.field-label {
  display: block; font-size: 14px; font-weight: 500;
  color: var(--c-label); margin-bottom: 4px;
}
.login-fields input[type="text"],
.login-fields input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--c-input-bg);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--c-text);
  outline: none;
  transition: border-color 150ms, background-color 150ms;
}
.login-fields input:focus {
  border-color: var(--c-out);
  background: var(--c-input-bg-focus);
}
.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--c-label);
  padding-top: 4px;
  cursor: pointer;
  user-select: none;
}
.remember input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--c-out);
  cursor: pointer;
}
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--c-out);
  color: white;
  font-weight: 600;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
  transition: filter 150ms;
}
.btn-primary:hover, .btn-primary:active { filter: brightness(1.1); }
.btn-primary:disabled { background: var(--c-dim); cursor: not-allowed; box-shadow: none; }
.login-footer {
  text-align: center; font-size: 12px;
  color: var(--c-dim); margin-top: 24px;
}

/* ---------- Grid sections ---------- */
.grid-top {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.grid-bot {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 12px;
}
/* Grid child'lara min-width: 0 — default 'auto' icindeki en buyuk
 * intrinsic content'e gore genisler ve grid'i tasirir. 0 ile shrink-to-fit. */
.grid-top > *, .grid-bot > * { min-width: 0; }
.relay-col { min-width: 0; }
.trend-svg { width: 100%; max-width: 100%; }

/* ---------- Card base ---------- */
.sensor-card, .comfort-card, .trend-card {
  background: linear-gradient(135deg, var(--c-card-top) 0%, var(--c-card-bot) 100%);
  border-radius: 16px;
  border: 1px solid var(--c-border);
  padding: 16px 20px;
  box-shadow: var(--c-shadow);
  transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

/* ---------- Sensor card ---------- */
.sensor-card {
  display: flex;
  flex-direction: column;
  min-height: 240px;
}
.sensor-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.sensor-card__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.sensor-card--in  .sensor-card__title { color: var(--c-in); }
.sensor-card--out .sensor-card__title { color: var(--c-out); }
.sensor-card__stale {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.18);
  color: var(--c-warn);
  letter-spacing: 0.06em;
}

/* Temp dijital */
.sensor-card__temp {
  display: flex;
  align-items: baseline;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 8px 0 12px 0;
}
.temp-int {
  font-size: 84px;
  font-weight: 700;
}
.temp-dec {
  font-size: 56px;
  font-weight: 700;
  margin-left: 2px;
}
.sensor-card--in  .temp-int,
.sensor-card--in  .temp-dec { color: var(--c-in); }
.sensor-card--out .temp-int,
.sensor-card--out .temp-dec { color: var(--c-out); }
.temp-unit {
  font-size: 18px;
  font-weight: 600;
  color: var(--c-label);
  margin-left: 6px;
  align-self: flex-start;
  margin-top: 6px;
}

/* Hissedilen */
.sensor-card__feels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}
.feels-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-label);
}
.feels-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sensor-card--in  .feels-value { color: var(--c-in); }
.sensor-card--out .feels-value { color: var(--c-out); }

/* Alt metric */
.sensor-card__foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.metric-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-label);
}
.metric-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Comfort gauge card ---------- */
.comfort-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 240px;
}
.comfort-card__head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--c-label);
  margin-bottom: 8px;
}
.comfort-card__gauge {
  position: relative;
  width: 100%;
  max-width: 320px;
  flex: 1;
}
.gauge-svg { width: 100%; height: auto; display: block; }
#comfort-arc {
  transition: stroke 300ms ease, stroke-dasharray 400ms ease;
}
.comfort-card__center {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.comfort-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-ok);
  letter-spacing: 0.04em;
  transition: color 300ms ease;
}
.comfort-clock {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--c-text);
  line-height: 1;
}
.comfort-card__date {
  font-size: 14px;
  color: var(--c-label);
  margin-top: 4px;
}

/* ---------- Trend chart ---------- */
.trend-card {
  display: flex;
  flex-direction: column;
}
.trend-card__head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--c-label);
  text-align: center;
  margin-bottom: 8px;
}
.trend-card__chart {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 120px;
}
.trend-ylabels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--c-dim);
  font-variant-numeric: tabular-nums;
  padding-right: 8px;
  text-align: right;
  min-width: 32px;
}
.trend-svg {
  flex: 1;
  height: 120px;
  background: var(--c-trend-bg);
  border-radius: 6px;
}
/* Trend SVG icindeki grid cizgileri tema bazli */
.trend-svg line { stroke: var(--c-grid-line); }
/* Konfor gauge'in arka plan (boş) arc'i da grid rengi kullansin */
.gauge-svg > path:first-of-type { stroke: var(--c-grid-line); }
.trend-card__legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--c-label);
}
.legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

/* ---------- Relay buttons ---------- */
.relay-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.relay-btn {
  background: linear-gradient(135deg, var(--c-card-top) 0%, var(--c-card-bot) 100%);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 14px 18px;
  color: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  flex: 1;
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  transition: border-color 200ms, background 200ms, opacity 200ms;
  position: relative;
  overflow: hidden;
}
.relay-btn:hover:not(:disabled) {
  border-color: rgba(255,255,255,0.18);
}
.relay-btn[data-state="on"] {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(16, 185, 129, 0.15) 100%);
  border-color: rgba(16, 185, 129, 0.5);
}
.relay-btn[data-state="on"] .relay-state {
  color: var(--c-ok);
}
.relay-btn[data-pending="true"] {
  opacity: 0.6;
  pointer-events: none;
}
.relay-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.relay-name {
  letter-spacing: 0.04em;
}
.relay-state {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-label);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--c-card-inset);
}

@keyframes pulse-soft {
  50% { opacity: 0.5; }
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100% - 32px);
}
.toast {
  pointer-events: auto;
  background: linear-gradient(135deg, #1F2540 0%, #161B2E 100%);
  color: var(--c-text);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border: 1px solid var(--c-border);
  border-left-width: 3px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 360px;
  font-size: 14px;
  animation: toast-in 200ms ease;
}
.toast.toast-leaving { animation: toast-out 200ms ease forwards; }
.toast.info    { border-left-color: var(--c-out); }
.toast.success { border-left-color: var(--c-ok); }
.toast.error   { border-left-color: var(--c-err); }
.toast.warning { border-left-color: var(--c-warn); }
.toast .toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast.info    .toast-icon { color: var(--c-out); }
.toast.success .toast-icon { color: var(--c-ok); }
.toast.error   .toast-icon { color: var(--c-err); }
.toast.warning .toast-icon { color: var(--c-warn); }
.toast .toast-text { flex: 1; min-width: 0; line-height: 1.35; }
.toast .toast-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--c-out);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes toast-in  { from { transform: translateY(20px); opacity: 0; } }
@keyframes toast-out { to   { transform: translateY(20px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
 *  RESPONSIVE
 * ============================================================ */

/* Tablet (≤ 1024 px): üst sıra ortaya alır, alt sıra 3 sütun kalır */
@media (max-width: 1024px) {
  .grid-top {
    grid-template-columns: 1fr 1fr;
  }
  .comfort-card {
    grid-column: 1 / -1;
    order: -1;       /* en üste */
  }
  .temp-int { font-size: 72px; }
  .temp-dec { font-size: 48px; }
}

/* Telefon (≤ 768 px): tek sütun, tüm kartlar alt alta */
@media (max-width: 768px) {
  .container { padding: 12px; }

  .grid-top, .grid-bot {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .comfort-card {
    grid-column: auto;
    order: 0;
  }
  /* sirayi degistir: ic -> dis -> konfor -> roleler -> trend */
  #card-in     { order: 1; }
  #card-out    { order: 2; }
  .comfort-card { order: 3; }

  .grid-bot {
    /* Telefon: hepsi tek sutun, sira: role 1+2, role 3+4, trend en altta */
    grid-template-columns: 1fr;
  }
  .relay-col {
    flex-direction: column;
    gap: 10px;
  }
  /* HTML sirasi: relay-col(1,2) -> trend -> relay-col(3,4)
   * order ile trend'i sona at, butun roleler ardisik olsun */
  .relay-col:first-child { order: 1; }
  .relay-col:last-child  { order: 2; }
  .trend-card           { order: 3; }
  .relay-btn {
    min-height: 56px;
    padding: 12px 16px;
    font-size: 16px;
  }
  .relay-state { font-size: 13px; padding: 4px 10px; }

  /* Sicaklik fontu daha kucuk */
  .temp-int { font-size: 64px; }
  .temp-dec { font-size: 42px; }
  .temp-unit { font-size: 14px; margin-top: 4px; }
  .feels-value { font-size: 20px; }
  .comfort-clock { font-size: 28px; }
  .sensor-card { min-height: 200px; padding: 14px 16px; }
  .comfort-card { min-height: 200px; padding: 14px 16px; }
}

/* Çok küçük ekran (≤ 380 px) */
@media (max-width: 380px) {
  .temp-int { font-size: 56px; }
  .temp-dec { font-size: 36px; }
  .topbar-inner { padding: 10px 12px; gap: 8px; }
  .dash-clock { font-size: 14px; }
}

/* Telefon butonlari biraz daha kompakt */
@media (max-width: 768px) {
  .btn-icon { width: 38px; height: 38px; }
  .btn-icon svg { width: 18px; height: 18px; }
}

/* ============================================================
   ADMIN AYARLAR MODAL
   ============================================================ */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  background: var(--card-bg, #1e293b);
  color: var(--text, #f1f5f9);
  border: 1px solid var(--border, #334155);
  border-radius: 14px;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #334155);
}
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-dim, #94a3b8);
  font-size: 28px; line-height: 1; padding: 0 8px;
}
.modal-close:hover { color: var(--text, #f1f5f9); }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.modal-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim, #94a3b8);
  line-height: 1.5;
}
.setting-group {
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.setting-group legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #06b6d4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.radio-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
}
.radio-row:hover { background: rgba(255,255,255,0.04); }
.radio-row input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--accent, #06b6d4);
  cursor: pointer;
}
.modal-status {
  min-height: 18px;
  font-size: 13px;
  text-align: center;
}
.modal-status.ok    { color: #10b981; }
.modal-status.err   { color: #ef4444; }
.modal-status.busy  { color: var(--text-dim, #94a3b8); }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border, #334155);
}
.btn-secondary {
  background: transparent;
  color: var(--text, #f1f5f9);
  border: 1px solid var(--border, #334155);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,0.04); }

/* Light tema overrides — modal panel her temada okunabilir kalsin */
[data-theme="light"] .modal-panel {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}
[data-theme="light"] .modal-head,
[data-theme="light"] .modal-foot {
  border-color: #e2e8f0;
}
[data-theme="light"] .setting-group {
  border-color: #cbd5e1;
}
[data-theme="light"] .radio-row:hover {
  background: rgba(0,0,0,0.04);
}
