/* ── Alarm panel styles ──────────────────────────────────────────────────────
   Same brass body / green-CRT screen / Cinzel brass-chip family as radio.css.
   Reuses the radio's visual values so the two panels read as one product line.
   Respects the --nw-* theme tokens (the green CRT accents derive from them) so
   dark/light/brightness still affect this panel. Does NOT restyle the radio.
   ──────────────────────────────────────────────────────────────────────────── */

#alarm-panel {
  position: fixed;
  bottom: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 58;
  width: 460px;
  max-width: calc(100vw - 24px);
}
#alarm-panel.hidden { display: none; }
#alarm-panel .hidden { display: none; }

.alarm-body {
  background:
    linear-gradient(168deg, rgba(255,180,90,0.12) 0%, rgba(0,0,0,0.16) 52%, rgba(0,0,0,0.40) 100%),
    url('/nightwatch/images/wood-walnut.svg');
  background-size: cover, 400px 220px;
  background-repeat: no-repeat, repeat;
  border-radius: 14px 14px 10px 10px;
  border: 1.5px solid #5a2e10;
  box-shadow:
    0 0 0 2px #2a1206,
    inset 0 1px 0 rgba(255,160,80,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.5),
    0 12px 40px rgba(0,0,0,0.78),
    0 4px 14px rgba(0,0,0,0.55);
  padding: 16px 20px 20px;
  position: relative;
}

/* Top bar / brand */
.alarm-top {
  display: flex; align-items: center; margin-bottom: 14px; gap: 10px;
}
.alarm-brand {
  display: flex; flex-direction: column; flex: 1; gap: 1px;
}
.ab-main {
  font-family: 'Cinzel Decorative', 'Trajan Pro', 'Palatino Linotype', serif;
  font-size: 0.82rem; letter-spacing: 0.08em; font-weight: 700;
  color: rgba(255,215,120,1); text-transform: uppercase; line-height: 1.15;
  text-shadow: 0 0 10px rgba(255,180,60,0.5);
}
.ab-sub {
  font-family: 'Cinzel', 'Trajan Pro', 'Palatino Linotype', serif;
  font-size: 0.5rem; letter-spacing: 0.3em;
  color: rgba(210,165,80,0.85); text-transform: uppercase; line-height: 1.1;
}
#alarm-close-btn {
  background: none; border: none;
  color: rgba(180,100,60,0.5); font-size: 0.85rem;
  cursor: pointer; padding: 2px 4px; border-radius: 3px;
  transition: color 0.12s; flex-shrink: 0;
}
#alarm-close-btn:hover { color: rgba(255,160,80,0.9); }

/* Recessed green-CRT screen holding the list */
.alarm-screen {
  background: color-mix(in srgb, var(--nw-fg) 5%, #000);
  border-radius: 6px;
  border: 1.5px solid color-mix(in srgb, var(--nw-fg) 22%, transparent);
  box-shadow:
    inset 0 0 14px rgba(0,0,0,0.75),
    inset 0 0 4px rgba(0,60,20,0.4),
    0 0 8px color-mix(in srgb, var(--nw-fg) 7%, transparent);
  padding: 8px 10px;
  margin-bottom: 12px;
  min-height: 62px;
  max-height: 280px;
  overflow-y: auto;
}

#alarm-empty {
  font-family: 'Courier New', monospace;
  font-size: 0.74rem; letter-spacing: 0.05em;
  color: color-mix(in srgb, var(--nw-fg) 55%, transparent);
  text-align: center; padding: 18px 0;
}
#alarm-empty.hidden { display: none; }

/* Alarm list rows */
.al-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--nw-fg) 12%, transparent);
}
.al-row:last-child { border-bottom: none; }
.al-row.off { opacity: 0.5; }

.al-info { flex: 1; min-width: 0; }
.al-top { display: flex; align-items: baseline; gap: 9px; }
.al-time {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem; font-weight: 700; letter-spacing: 0.03em;
  color: var(--nw-fg);
  text-shadow: 0 0 10px color-mix(in srgb, var(--nw-fg) 70%, transparent), 0 0 3px color-mix(in srgb, var(--nw-fg) 40%, transparent);
}
.al-label {
  font-family: 'Courier New', monospace;
  font-size: 0.7rem; color: color-mix(in srgb, var(--nw-fg) 75%, transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.al-sub {
  font-family: 'Courier New', monospace;
  font-size: 0.58rem; color: color-mix(in srgb, var(--nw-fg) 60%, transparent);
  letter-spacing: 0.04em; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.al-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

/* Green enable/disable pill (uses the radio's green accent) */
.al-enable {
  flex: 0 0 auto; padding: 3px 9px; cursor: pointer; font-family: inherit;
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.08em; border-radius: 20px;
  background: linear-gradient(180deg, #4a2c10, #2a1606); color: rgba(200,150,90,0.6);
  border: 1px solid #4a2c10; box-shadow: inset 0 1px 0 rgba(255,200,120,0.12);
  transition: all 0.1s;
}
.al-enable.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--nw-fg) 80%, #fff 20%), color-mix(in srgb, var(--nw-fg) 65%, #000 35%)); color: #042008;
  border-color: color-mix(in srgb, var(--nw-fg) 50%, #000); box-shadow: 0 0 10px color-mix(in srgb, var(--nw-fg) 45%, transparent), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* Brass mini-chips (matches .radio-chip) */
.alarm-chip {
  flex: 0 0 auto; min-width: 26px; padding: 4px 8px; cursor: pointer;
  background: linear-gradient(180deg, #c8b090 0%, #8a6040 42%, #6a4828 100%);
  border: 1px solid #4a2c10; border-radius: 5px; color: #1a0c04;
  font-size: 0.66rem; font-weight: 700; font-family: 'Inter', system-ui, sans-serif;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.4), 0 1px 3px rgba(0,0,0,0.5);
  transition: all 0.08s;
}
.alarm-chip:hover { filter: brightness(1.12); }
.alarm-chip.active { background: linear-gradient(180deg, color-mix(in srgb, var(--nw-fg) 80%, #fff 20%), color-mix(in srgb, var(--nw-fg) 65%, #000 35%)); color: #042008; border-color: color-mix(in srgb, var(--nw-fg) 50%, #000); }
.alarm-chip.hidden { display: none; }

/* Footer with Add button */
.alarm-footer { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ── Add / edit form ──────────────────────────────────────────────────────── */
#alarm-form { margin-top: 12px; }
#alarm-form.hidden { display: none; }

.af-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.af-label {
  flex: 0 0 64px;
  font-family: 'Cinzel', 'Palatino Linotype', serif;
  font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,205,110,0.85);
}

#af-label, #af-time, #af-chime, #af-station {
  font-family: 'Courier New', monospace; font-size: 0.72rem;
  background: color-mix(in srgb, var(--nw-fg) 5%, #000); border: 1px solid color-mix(in srgb, var(--nw-fg) 40%, transparent); border-radius: 5px;
  color: color-mix(in srgb, var(--nw-fg) 72%, #fff 28%); padding: 5px 8px; letter-spacing: 0.02em;
}
#af-label { flex: 1; min-width: 0; }
#af-label::placeholder { color: color-mix(in srgb, var(--nw-fg) 40%, transparent); }
#af-label:focus, #af-time:focus, #af-chime:focus, #af-station:focus {
  outline: none; border-color: color-mix(in srgb, var(--nw-fg) 60%, transparent); box-shadow: 0 0 6px color-mix(in srgb, var(--nw-fg) 25%, transparent);
}
#af-time { color-scheme: dark; }

/* Day toggle chips */
.af-days { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.af-day {
  flex: 0 0 auto; padding: 4px 7px; cursor: pointer; font-family: 'Courier New', monospace;
  font-size: 0.6rem; font-weight: 700; border-radius: 5px;
  background: linear-gradient(180deg, #4a2c10, #2a1606); color: rgba(200,150,90,0.65);
  border: 1px solid #4a2c10; box-shadow: inset 0 1px 0 rgba(255,200,120,0.1);
  transition: all 0.08s;
}
.af-day:hover { filter: brightness(1.15); }
.af-day.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--nw-fg) 80%, #fff 20%), color-mix(in srgb, var(--nw-fg) 65%, #000 35%)); color: #042008;
  border-color: color-mix(in srgb, var(--nw-fg) 50%, #000); box-shadow: 0 0 8px color-mix(in srgb, var(--nw-fg) 45%, transparent), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* Sound picker */
.af-sound { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.af-sound-tabs { display: flex; gap: 6px; }
#af-chime-wrap, #af-station-wrap { display: flex; gap: 6px; align-items: center; }
#af-chime-wrap.hidden, #af-station-wrap.hidden { display: none; }
#af-chime, #af-station { flex: 1; min-width: 0; }

/* Enabled toggle (same green pill as the list) */
.af-toggle {
  flex: 0 0 auto; padding: 4px 12px; cursor: pointer; font-family: inherit;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; border-radius: 20px;
  background: linear-gradient(180deg, #4a2c10, #2a1606); color: rgba(200,150,90,0.6);
  border: 1px solid #4a2c10; box-shadow: inset 0 1px 0 rgba(255,200,120,0.12);
  transition: all 0.1s;
}
.af-toggle.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--nw-fg) 80%, #fff 20%), color-mix(in srgb, var(--nw-fg) 65%, #000 35%)); color: #042008;
  border-color: color-mix(in srgb, var(--nw-fg) 50%, #000); box-shadow: 0 0 10px color-mix(in srgb, var(--nw-fg) 45%, transparent), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* Save / Cancel — chrome brass buttons (matches .radio-btn-chrome) */
.af-actions { display: flex; gap: 8px; margin-top: 14px; }
.alarm-btn-chrome {
  flex: 1;
  background: linear-gradient(180deg, #c8b090 0%, #8a6040 42%, #6a4828 100%);
  border: 1px solid #4a2c10;
  border-radius: 5px; color: #1a0c04;
  font-size: 0.72rem; font-weight: 700;
  padding: 7px 9px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.4), 0 2px 4px rgba(0,0,0,0.55);
  transition: all 0.08s;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0.02em; user-select: none;
}
.alarm-btn-chrome:hover {
  background: linear-gradient(180deg, #dfc8a8 0%, #aa7c50 42%, #8a5830 100%);
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.5), 0 3px 6px rgba(0,0,0,0.6);
}
.alarm-btn-chrome:active {
  background: linear-gradient(0deg, #c0a880 0%, #7a5030 100%);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.45);
  transform: translateY(1px);
}

/* ── Firing (ringing) overlay ─────────────────────────────────────────────────
   A wake event must be fully visible even at the dimmest brightness, so this
   sits ABOVE the brightness dim overlay (body::after, z-index 50) and paints an
   opaque backdrop. Same brass body / green-CRT screen family as the panels. */
#alarm-ring {
  position: fixed; inset: 0;
  z-index: 90;                 /* above body::after dim (50) and panels (58) */
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #0b1c10 0%, #03080500 0%, #020503 100%), #020503;
}
#alarm-ring.hidden { display: none; }

.ring-body {
  position: relative;
  background:
    linear-gradient(168deg, rgba(255,180,90,0.12) 0%, rgba(0,0,0,0.16) 52%, rgba(0,0,0,0.40) 100%),
    url('/nightwatch/images/wood-walnut.svg');
  background-size: cover, 400px 220px;
  background-repeat: no-repeat, repeat;
  border-radius: 16px;
  border: 1.5px solid #5a2e10;
  box-shadow:
    0 0 0 2px #2a1206,
    inset 0 1px 0 rgba(255,160,80,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.5),
    0 18px 60px rgba(0,0,0,0.85);
  padding: 34px 44px 22px;
  text-align: center;
  max-width: calc(100vw - 32px);
  overflow: hidden;
}

/* Gentle breathing pulse behind the time */
.ring-pulse {
  position: absolute; inset: 0;
  pointer-events: none; border-radius: 16px;
  background: radial-gradient(ellipse at 50% 38%, color-mix(in srgb, var(--nw-fg) 18%, transparent), transparent 62%);
  animation: ring-breathe 2.4s ease-in-out infinite;
}
@keyframes ring-breathe {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.ring-time {
  position: relative;
  font-family: 'Courier New', monospace;
  font-size: clamp(2.6rem, 13vmin, 5rem); font-weight: 700; letter-spacing: 0.03em;
  color: var(--nw-fg); line-height: 1;
  text-shadow: 0 0 18px color-mix(in srgb, var(--nw-fg) 70%, transparent), 0 0 5px color-mix(in srgb, var(--nw-fg) 50%, transparent);
}
.ring-label {
  position: relative;
  font-family: 'Cinzel', 'Palatino Linotype', serif;
  font-size: 1rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,205,110,0.9); margin-top: 12px;
  text-shadow: 0 0 10px rgba(255,180,60,0.4);
}

.ring-actions {
  position: relative;
  display: flex; gap: 12px; justify-content: center; margin-top: 28px;
}
.ring-btn {
  flex: 1 1 0; min-width: 120px; padding: 12px 16px; cursor: pointer;
  border-radius: 8px; font-weight: 700; font-size: 0.9rem; letter-spacing: 0.04em;
  font-family: 'Inter', system-ui, sans-serif;
  transition: all 0.08s;
}
.ring-snooze {
  background: linear-gradient(180deg, #c8b090 0%, #8a6040 42%, #6a4828 100%);
  border: 1px solid #4a2c10; color: #1a0c04;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.4), 0 2px 5px rgba(0,0,0,0.55);
}
.ring-snooze:hover { filter: brightness(1.12); }
.ring-dismiss {
  background: linear-gradient(180deg, color-mix(in srgb, var(--nw-fg) 80%, #fff 20%), color-mix(in srgb, var(--nw-fg) 65%, #000 35%));
  border: 1px solid color-mix(in srgb, var(--nw-fg) 50%, #000); color: #042008;
  box-shadow: 0 0 12px color-mix(in srgb, var(--nw-fg) 45%, transparent), inset 0 1px 0 rgba(255,255,255,0.3);
}
.ring-dismiss:hover { filter: brightness(1.08); }
.ring-btn:active { transform: translateY(1px); }

.ring-nameplate {
  position: relative;
  margin-top: 22px;
  font-family: 'Cinzel', 'Trajan Pro', 'Palatino Linotype', serif;
  font-size: 0.62rem; letter-spacing: 0.55em;
  color: rgba(210,165,80,0.6); text-transform: lowercase; white-space: pre;
  user-select: none;
}

/* Brass nameplate */
.alarm-model-label {
  background: linear-gradient(90deg, #7a5510 0%, #c8902a 28%, #e8b840 50%, #c8902a 72%, #7a5510 100%);
  border-top: 1px solid rgba(255,220,120,0.35);
  border-radius: 0 0 9px 9px;
  margin-top: 12px;
  padding: 6px 12px 8px;
  text-align: center;
  font-family: 'Cinzel', 'Trajan Pro', 'Palatino Linotype', serif;
  font-size: 0.68rem; letter-spacing: 0.6em;
  color: rgba(15,5,0,0.95); font-weight: 700;
  text-transform: lowercase; white-space: pre;
  text-shadow: 0 1px 0 rgba(255,245,170,0.7), 0 -1px 0 rgba(80,30,0,0.3);
  user-select: none;
}
