/* ============================================================
   Little Kitchen — Premium CSS
   OLED dark theme · Orange accent #f97316 · Mobile-first
   Fira Code (data) · Inter (UI)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  /* Backgrounds */
  --bg:           #080808;
  --bg-card:      #111111;
  --bg-secondary: #181818;
  --bg-tertiary:  #212121;

  /* Primary — Orange */
  --primary:        #f97316;
  --primary-dim:    rgba(249,115,22,0.10);
  --primary-mid:    rgba(249,115,22,0.18);
  --primary-glow:   0 0 24px rgba(249,115,22,0.28);
  --primary-border: rgba(249,115,22,0.22);

  /* Danger — Red */
  --danger:        #ef4444;
  --danger-dim:    rgba(239,68,68,0.10);
  --danger-mid:    rgba(239,68,68,0.18);
  --danger-glow:   0 0 24px rgba(239,68,68,0.35);
  --danger-border: rgba(239,68,68,0.25);

  /* Success — Green */
  --success:        #22c55e;
  --success-dim:    rgba(34,197,94,0.10);
  --success-mid:    rgba(34,197,94,0.18);
  --success-glow:   0 0 16px rgba(34,197,94,0.25);

  /* Typography */
  --text:           #f1f5f9;
  --text-secondary: #94a3b8;
  --muted:          #64748b;

  /* Borders */
  --border:        #1c1c1c;
  --border-bright: #2a2a2a;

  /* Shape */
  --radius:    16px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  /* Fonts */
  --font-mono: 'Fira Code', 'SF Mono', 'Consolas', monospace;
  --font-ui:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input  { font-family: inherit; }
h1, h2, h3 { margin: 0; }

*::-webkit-scrollbar { width: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 75% 10%, rgba(249,115,22,0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 15% 90%, rgba(249,115,22,0.05) 0%, transparent 45%),
    radial-gradient(rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(17,17,17,0.96);
  border: 1px solid var(--border-bright);
  border-radius: 24px;
  padding: 44px 36px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    0 32px 80px rgba(0,0,0,0.65),
    0 0 60px rgba(249,115,22,0.06);
  position: relative;
  z-index: 1;
}

/* Subtle top gradient accent */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 20px; right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(249,115,22,0.5), transparent);
  border-radius: 1px;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(145deg, rgba(249,115,22,0.15), rgba(249,115,22,0.06));
  border: 1px solid rgba(249,115,22,0.28);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow:
    0 0 32px rgba(249,115,22,0.14),
    inset 0 1px 0 rgba(255,255,255,0.06);
}
.login-icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 1.8;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* Form */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xs);
  padding: 13px 16px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
}
.form-input:focus {
  border-color: var(--primary);
  background: rgba(249,115,22,0.03);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.10);
}
.form-input::placeholder { color: var(--muted); }

.btn-primary {
  width: 100%;
  background: linear-gradient(145deg, #f97316, #e8650a);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.01em;
  transition: opacity 0.2s, box-shadow 0.2s, transform 0.1s;
  box-shadow: 0 4px 20px rgba(249,115,22,0.35), inset 0 1px 0 rgba(255,255,255,0.10);
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
}
.btn-primary:hover  { opacity: 0.92; box-shadow: 0 6px 28px rgba(249,115,22,0.45); }
.btn-primary:active { transform: translateY(1px); opacity: 0.85; }
.btn-primary:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

.error-msg {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.22);
  border-radius: var(--radius-xs);
  padding: 11px 14px;
  font-size: 13px;
  color: #fca5a5;
  margin-top: 14px;
  display: none;
  animation: fadeInDown 0.22s ease;
}
.error-msg.show { display: block; }

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-footer {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 28px;
  letter-spacing: 0.04em;
}

/* ================================================================
   DASHBOARD LAYOUT
   ================================================================ */

.dashboard-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ── */
.top-bar {
  background: rgba(9,9,9,0.93);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-bar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.top-bar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(145deg, rgba(249,115,22,0.18), rgba(249,115,22,0.07));
  border: 1px solid rgba(249,115,22,0.22);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg { width: 17px; height: 17px; stroke: var(--primary); fill: none; stroke-width: 2; }

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-location {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.brand-location svg { width: 10px; height: 10px; fill: var(--muted); stroke: none; }

.top-bar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.clock-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  white-space: nowrap;
}
.clock-tz { font-size: 9px; color: var(--muted); letter-spacing: 0.05em; }

.btn-logout {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
  min-height: 34px;
}
.btn-logout:hover {
  background: rgba(239,68,68,0.08);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.22);
}
.btn-logout svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.btn-profile {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.btn-profile:hover { background: rgba(255,255,255,0.06); color: var(--text); border-color: var(--border-bright); }
.btn-profile svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── Profile Panel ── */
.profile-backdrop {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.5); align-items: flex-start; justify-content: flex-end;
}
.profile-backdrop.open { display: flex; }
.profile-panel {
  background: var(--surface-2, #1a1a1a);
  border-left: 1px solid var(--border);
  width: 260px; min-height: 100vh;
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
}
.profile-panel .modal-close { position: absolute; top: 14px; right: 14px; }
.profile-name { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 24px; }
.profile-id   { font-size: 12px; color: var(--muted); }
.profile-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.profile-action-btn {
  padding: 10px 14px; border-radius: 8px; font-size: 13px; text-align: left;
  border: 1px solid var(--border); color: var(--text);
  background: transparent; cursor: pointer;
  transition: background 0.15s;
}
.profile-action-btn:hover { background: rgba(255,255,255,0.05); }
.profile-action-btn.danger { color: #f87171; border-color: rgba(239,68,68,0.3); }
.profile-action-btn.danger:hover { background: rgba(239,68,68,0.08); }

/* ── Power Strip ── */
.power-strip {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 16px 0;
  width: 100%;
}

.power-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 500;
  transition: border-color 0.3s;
}
.power-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.power-indicator.online .power-dot {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34,197,94,0.6), 0 0 12px rgba(34,197,94,0.3);
  animation: pulseDot 2.2s ease-in-out infinite;
}
.power-indicator.offline .power-dot {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(239,68,68,0.6);
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}
.power-indicator.online  { border-color: rgba(34,197,94,0.2); }
.power-indicator.offline { border-color: rgba(239,68,68,0.2); }
.power-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted); transition: color 0.3s; }
.power-indicator.online  .power-label { color: var(--success); }
.power-indicator.offline .power-label { color: var(--danger); }

/* ── Dashboard Content ── */
.dashboard-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ================================================================
   CARDS — Base
   ================================================================ */

@keyframes cardPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(249,115,22,0.04), 0 4px 24px rgba(0,0,0,0.35); }
  50%       { box-shadow: 0 0 22px rgba(249,115,22,0.13), 0 4px 24px rgba(0,0,0,0.35); }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  animation: cardPulse 5s ease-in-out infinite;
}

/* Glowing top accent — always visible, pulses on hover */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(249,115,22,0.5) 50%, transparent 100%);
  opacity: 0.35;
  transition: opacity 0.3s;
}
.card:hover::before { opacity: 1; }

.card-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.card-title svg {
  width: 14px;
  height: 14px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

/* ================================================================
   APPLIANCE CARDS
   ================================================================ */
.appliance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.appliance-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  position: relative;
  overflow: hidden;
}
.appliance-card.on {
  border-color: rgba(34,197,94,0.28);
  background: linear-gradient(135deg, rgba(34,197,94,0.06) 0%, var(--bg-secondary) 70%);
  box-shadow: inset 0 1px 0 rgba(34,197,94,0.08);
}
.appliance-card.pending {
  border-color: rgba(251,191,36,0.35);
  background: linear-gradient(135deg, rgba(251,191,36,0.06) 0%, var(--bg-secondary) 70%);
  box-shadow: inset 0 1px 0 rgba(251,191,36,0.08);
  animation: amberPulse 1.5s ease-in-out infinite;
}
@keyframes amberPulse {
  0%, 100% { border-color: rgba(251,191,36,0.2); box-shadow: 0 0 0 rgba(251,191,36,0); }
  50%      { border-color: rgba(251,191,36,0.55); box-shadow: 0 0 14px rgba(251,191,36,0.12); }
}
.appliance-card.pending .appliance-icon-wrap {
  background: rgba(251,191,36,0.10);
  border-color: rgba(251,191,36,0.22);
}
.appliance-card.pending .appliance-icon-wrap svg { stroke: #fbbf24; }
.appliance-card.pending .status-dot {
  background: #fbbf24;
  box-shadow: 0 0 5px rgba(251,191,36,0.6);
  animation: pulseDot 2.2s ease-in-out infinite;
}
.appliance-card.pending .status-text { color: #fbbf24; }

.appliance-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.appliance-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.25s, border-color 0.25s;
}
.appliance-card.on .appliance-icon-wrap {
  background: var(--success-dim);
  border-color: rgba(34,197,94,0.22);
}
.appliance-icon-wrap svg {
  width: 20px;
  height: 20px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  transition: stroke 0.25s;
}
.appliance-card.on .appliance-icon-wrap svg { stroke: var(--success); }

.appliance-info { flex: 1; min-width: 0; }
.appliance-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appliance-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}
.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.25s, box-shadow 0.25s;
}
.appliance-card.on .status-dot {
  background: var(--success);
  box-shadow: 0 0 5px rgba(34,197,94,0.6);
  animation: pulseDot 2.2s ease-in-out infinite;
}
.status-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: color 0.25s;
}
.appliance-card.on .status-text { color: var(--success); }

.appliance-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.btn-toggle {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  transition: opacity 0.15s, transform 0.1s;
  min-width: 44px;
  min-height: 28px;
  text-align: center;
}
.btn-toggle.turn-on {
  background: rgba(34,197,94,0.12);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.22);
}
.btn-toggle.turn-off {
  background: rgba(239,68,68,0.12);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.22);
}
.btn-toggle:hover:not(:disabled) { opacity: 0.78; transform: scale(0.97); }
.btn-toggle:disabled { opacity: 0.32; cursor: not-allowed; transform: none; }

.btn-timer {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-timer:hover {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: var(--primary-border);
}
.btn-timer svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.timer-row {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.timer-row.open { display: flex; }

.timer-input {
  width: 60px;
  background: var(--bg);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
  min-height: 32px;
  -webkit-appearance: none;
  appearance: none;
}
.timer-input:focus { border-color: var(--primary); }
.timer-input::-webkit-inner-spin-button,
.timer-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.btn-timer-start {
  margin-left: auto;
  background: linear-gradient(145deg, var(--primary), #e8650a);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-timer-start:hover { opacity: 0.88; }

/* ================================================================
   TEMPERATURE ZONE CARDS
   ================================================================ */
.zone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.zone-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s, transform 0.1s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.zone-card:hover { border-color: var(--primary-border); }
.zone-card:active { transform: scale(0.98); }

.zone-card.alert {
  background: linear-gradient(135deg, rgba(239,68,68,0.08) 0%, var(--bg-secondary) 70%);
  border-color: rgba(239,68,68,0.32);
  box-shadow: inset 0 1px 0 rgba(239,68,68,0.08);
}

.zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 6px;
}
.zone-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  min-width: 0;
  overflow: hidden;
}
.zone-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.zone-label-row svg {
  width: 12px;
  height: 12px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 2.5;
  flex-shrink: 0;
}
.zone-card.alert .zone-label-row svg { stroke: var(--danger); }

.zone-alert-badge {
  display: none;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--danger);
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 10px;
  padding: 2px 7px;
  flex-shrink: 0;
  white-space: nowrap;
}
.zone-card.alert .zone-alert-badge { display: inline-block; }

.zone-temp {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
  transition: color 0.25s;
}
.zone-card.alert .zone-temp { color: var(--danger); }

.zone-temp-unit {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.zone-meta {
  display: flex;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
  flex-wrap: wrap;
}

.zone-waiting {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

/* ================================================================
   SAFETY SENSOR CARDS
   ================================================================ */
.safety-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.safety-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s, transform 0.1s;
  text-align: center;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.safety-card:hover { border-color: var(--primary-border); }
.safety-card:active { transform: scale(0.97); }

.safety-card.alert {
  background: linear-gradient(145deg, rgba(239,68,68,0.11) 0%, var(--bg-secondary) 80%);
  border-color: rgba(239,68,68,0.35);
  animation: pulseAlert 1.8s ease-in-out infinite;
}

@keyframes pulseAlert {
  0%, 100% { box-shadow: 0 0 0 1px rgba(239,68,68,0.08); }
  50%       { box-shadow: 0 0 18px rgba(239,68,68,0.40), 0 0 0 1px rgba(239,68,68,0.30); }
}

.safety-icon { margin-bottom: 10px; }
.safety-icon svg {
  width: 26px;
  height: 26px;
  stroke: var(--success);
  fill: none;
  stroke-width: 1.8;
  transition: stroke 0.25s;
}
.safety-card.alert .safety-icon svg { stroke: var(--danger); }

.safety-type {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}
.safety-status {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  transition: color 0.25s;
  letter-spacing: 0.03em;
}
.safety-card.alert .safety-status { color: var(--danger); }

/* ================================================================
   ACTIVITY LOG
   ================================================================ */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(255,255,255,0.018);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font-size: 12px;
  transition: background 0.15s, border-color 0.15s;
}
.activity-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
}

.activity-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.activity-dot.green  { background: var(--success); box-shadow: 0 0 5px rgba(34,197,94,0.50); }
.activity-dot.red    { background: var(--danger);  box-shadow: 0 0 5px rgba(239,68,68,0.50); }
.activity-dot.orange { background: var(--primary); box-shadow: 0 0 5px rgba(249,115,22,0.50); }
.activity-dot.gray   { background: var(--muted); }

.activity-msg  { flex: 1; color: var(--text-secondary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 28px 0;
}

/* ================================================================
   MODALS — Bottom Sheet
   ================================================================ */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-backdrop.open { display: flex; }

.modal-sheet {
  background: var(--bg-card);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--border-bright);
  border-bottom: none;
  width: 100%;
  max-width: 960px;
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.30s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -12px 48px rgba(0,0,0,0.50);
}

/* Drag handle */
.modal-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--border-bright);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--border-bright); color: var(--text); }
.modal-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}

.modal-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 12px;
}
.modal-log-row:last-child { border-bottom: none; }

.modal-log-temp {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.modal-log-temp.alert { color: var(--danger); }
.modal-log-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.modal-empty, .modal-loading {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 44px 0;
}

/* ================================================================
   PAYMENT OVERLAY
   ================================================================ */
.payment-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.90);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.payment-overlay.open { display: flex; }

.payment-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 24px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    0 32px 80px rgba(0,0,0,0.68),
    0 0 48px rgba(249,115,22,0.06);
  position: relative;
}
.payment-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 20px; right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(249,115,22,0.5), transparent);
}

.payment-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.payment-sub   { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.65; }

.plan-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.plan-card:hover { border-color: var(--primary-border); }
.plan-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.plan-price {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  margin: 4px 0 8px;
}
.plan-features { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.65; }

.btn-select-plan {
  width: 100%;
  background: linear-gradient(145deg, var(--primary), #e8650a);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 12px;
  border-radius: 9px;
  letter-spacing: 0.02em;
  transition: opacity 0.2s;
  box-shadow: 0 4px 18px rgba(249,115,22,0.32);
}
.btn-select-plan:hover { opacity: 0.90; }

/* ================================================================
   LOADING SPINNER
   ================================================================ */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* Small phones (< 480px) */
@media (max-width: 480px) {
  .appliance-grid { grid-template-columns: 1fr; }
  .safety-grid    { grid-template-columns: 1fr 1fr 1fr; }
  .login-card     { padding: 32px 20px; }
  .clock-display  { display: none; }
  .btn-logout span { display: none; }
  .btn-logout     { padding: 6px; width: 34px; justify-content: center; }
  .top-bar-inner  { height: 52px; }

  /* Zone grid — 2 columns side by side */
  .zone-grid      { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Arc gauge — hidden on mobile */
  .zone-arc       { display: none; }

  /* Zone card — tall card with room to breathe */
  .zone-card      { padding: 18px 14px 16px; min-height: 180px; display: flex; flex-direction: column; justify-content: space-between; }

  /* Label — bigger and readable */
  .zone-label-row  { font-size: 15px; gap: 5px; }
  .zone-label-row svg { width: 16px; height: 16px; }
  .zone-label-text { max-width: none; }

  /* Temperature number — large, takes the vertical space */
  .zone-temp      { font-size: 42px; margin-top: 8px; flex: 1; display: flex; align-items: center; }
  .zone-temp-unit { font-size: 18px; }

  /* Lo/Hi/time data row — stacked vertically */
  .zone-meta      { font-size: 11px; flex-direction: column; gap: 3px; margin-top: 10px; }

  /* Alert badge */
  .zone-alert-badge { font-size: 9px; padding: 2px 7px; }
}

/* Touch devices — slightly brighter, tap feedback */
@media (hover: none) {
  .btn-rename-appliance { opacity: 0.60; }
  .btn-rename-zone      { opacity: 0.60; }
  .btn-rename-appliance:active,
  .btn-rename-zone:active { opacity: 1; background: rgba(255,255,255,0.10); }
}

/* Tablets (≥ 640px) */
@media (min-width: 640px) {
  .appliance-grid { grid-template-columns: 1fr 1fr; }
  .clock-display  { display: flex; }
  .dashboard-content { padding: 24px 20px 64px; }
}

/* Desktop (≥ 960px) */
@media (min-width: 960px) {
  .dashboard-content { padding: 28px 24px 64px; }
  .zone-temp         { font-size: 40px; }
  .zone-temp-unit    { font-size: 18px; }
  .card              { padding: 24px; }
}

/* ================================================================
   RENAME BUTTONS — hidden until hover
   ================================================================ */
.appliance-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.appliance-name-row .appliance-name {
  flex: 1;
  min-width: 0;
}
/* Zone rename — top-right corner of card (right side is free) */
.btn-rename-zone {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0.45;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  color: var(--muted);
  padding: 5px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  z-index: 2;
}
.btn-rename-zone:hover { opacity: 1; color: var(--text); background: rgba(255,255,255,0.08); }

/* Appliance rename — inline next to label (right side has toggle button) */
.btn-rename-appliance {
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  color: var(--muted);
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.btn-rename-appliance:hover { opacity: 1; color: var(--text); background: rgba(255,255,255,0.08); }

/* ================================================================
   ZONE COLOUR THEMING  #1 — cold (cyan) · hot (orange)
   ================================================================ */
:root {
  --cold:        #06b6d4;
  --cold-dim:    rgba(6,182,212,0.08);
  --cold-border: rgba(6,182,212,0.25);
  --cold-mid:    rgba(6,182,212,0.18);
}

/* Cold zones (freezer, fridge1, fridge2) */
.zone-card.cold {
  background:
    linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
    linear-gradient(135deg, rgba(6,182,212,0.32) 0%, rgba(6,182,212,0.06) 100%) border-box;
  border: 1px solid transparent;
}
.zone-card.cold .zone-label-row svg  { stroke: var(--cold); }
.zone-card.cold .zone-temp           { color: var(--cold); }
.zone-card.cold:hover                { border-color: transparent; }

/* Cooking / hot zone */
.zone-card.hot {
  background:
    linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
    linear-gradient(135deg, rgba(249,115,22,0.25) 0%, rgba(249,115,22,0.05) 100%) border-box;
  border: 1px solid transparent;
}
.zone-card.hot .zone-label-row svg { stroke: var(--primary); }
.zone-card.hot .zone-temp          { color: var(--primary); }
.zone-card.hot:hover               { border-color: transparent; }

/* Alert overrides both — gradient red border + ambient glow  #5 */
.zone-card.alert {
  background:
    linear-gradient(135deg, rgba(239,68,68,0.09) 0%, var(--bg-secondary) 65%) padding-box,
    linear-gradient(135deg, rgba(239,68,68,0.48) 0%, rgba(239,68,68,0.12) 100%) border-box !important;
  border: 1px solid transparent !important;
  box-shadow: 0 0 32px rgba(239,68,68,0.20), 0 0 8px rgba(239,68,68,0.10);
}
.zone-card.alert .zone-temp     { color: var(--danger); }
.zone-card.alert .zone-arc-fill { stroke: var(--danger) !important; }

/* ================================================================
   ARC GAUGE  #2 — decorative arc in bottom-right of zone card
   r=30  circumference≈188.5  240° arc ≈ 125.66  gap ≈ 62.83
   rotate(150deg) → arc runs from bottom-left → 12 o'clock → bottom-right
   ================================================================ */
.zone-arc {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 68px;
  height: 68px;
  pointer-events: none;
  opacity: 0.50;
  overflow: visible;
}

.zone-arc-track {
  fill: none;
  stroke: rgba(255,255,255,0.07);
  stroke-width: 2.5;
  stroke-dasharray: 125.66 62.83;
  stroke-linecap: round;
  transform: rotate(150deg);
  transform-origin: 40px 40px;
}

.zone-arc-fill {
  fill: none;
  stroke: var(--cold);
  stroke-width: 2.5;
  stroke-dasharray: 125.66 62.83;
  stroke-dashoffset: 125.66; /* starts empty — JS animates this */
  stroke-linecap: round;
  transform: rotate(150deg);
  transform-origin: 40px 40px;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s;
}

.zone-card.hot  .zone-arc-fill { stroke: var(--primary); }
.zone-card.cold .zone-arc-fill { stroke: var(--cold); }
