/* ==========================================================================
   European Studio Hardware Design System (Dieter Rams / Industrial Aesthetic)
   Typography: Self-Hosted Inter with Tabular Figures (Zero Internet Dependency)
   ========================================================================== */

/* Self-Hosted Inter Font Definitions (WOFF2) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/Inter-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/Inter-Medium.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/Inter-SemiBold.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/Inter-Bold.woff2') format('woff2');
}

:root {
  /* Color Palette - Dark (Default) */
  --bg-canvas: #0e1014;
  --bg-surface: #15181f;
  --bg-surface-subtle: #1c2028;
  --bg-surface-elevated: #242934;
  --border: #292f3c;
  --border-focus: #4b5568;

  --text-primary: #f3f4f6;
  --text-secondary: #9aa3af;
  --text-muted: #828b98;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-live: #ef4444;
  --accent-active: #10b981;
  --accent-warning: #f59e0b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  /* Studio Hardware Fader Tokens */
  --fader-thumb-bg: linear-gradient(180deg, #374151 0%, #1f2937 100%);
  --fader-thumb-border: #4b5563;
  --fader-notch: #ffffff;
  --fader-track-bg: #090a0d;
}

[data-theme="light"] {
  --bg-canvas: #f1f3f6;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f8fafc;
  --bg-surface-elevated: #eef2f6;
  --border: #d7dce3;
  --border-focus: #94a3b8;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-live: #dc2626;
  --accent-active: #059669;
  --accent-warning: #d97706;

  /* Studio Hardware Fader Tokens - Light Theme */
  --fader-thumb-bg: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
  --fader-thumb-border: #94a3b8;
  --fader-notch: #0f172a;
  --fader-track-bg: #e2e8f0;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Explicit Typography Inheritance for Form Controls & Buttons */
button,
input,
select,
textarea,
optgroup {
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "tnum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "tnum";
  /* Safe Area Inset Support for iPhone notch & home indicator */
  padding: max(0.65rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Typography & Badges */
.mono {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.badge-live {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-live);
  border-color: rgba(239, 68, 68, 0.3);
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-active);
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-muted {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border-color: var(--border);
}

.badge-role {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
  font-family: var(--font-mono);
}

/* ==========================================================================
   STUDIO HARDWARE CHIP / TAG DESIGN SYSTEM
   Replaces raw parenthetical/bracketed text with sleek, tactile tags
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.42rem;
  border-radius: var(--radius-sm);
  line-height: 1.25;
  vertical-align: middle;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip-neutral {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.chip-subtle {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

[data-theme="light"] .chip-subtle {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
}

.chip-live {
  background: rgba(239, 68, 68, 0.12);
  color: #ff6b6b;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

[data-theme="light"] .chip-live {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.1);
}

.chip-active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .chip-active {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
}

.chip-primary {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

[data-theme="light"] .chip-primary {
  color: #2563eb;
  background: rgba(59, 130, 246, 0.1);
}

.chip.mono {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

.chip-editable {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
  user-select: none;
  gap: 4px;
}

.chip-editable:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-primary);
}

.chip-editable:active {
  transform: scale(0.96);
}

.chip-edit-icon {
  opacity: 0.6;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.chip-editable:hover .chip-edit-icon {
  opacity: 1;
}

/* Top Station Header */
.header-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.indicator-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-active);
  display: inline-block;
  flex-shrink: 0;
}

.indicator-led.offline {
  background: var(--accent-live);
}

.indicator-led.warning {
  background: var(--accent-warning);
}

.station-brand {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.clock-display {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-header {
  font-family: var(--font-sans);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
}

.btn-header:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

/* Studio Surface Card */
.studio-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.card-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   PUBLIC ADDRESS (PA) & ANNOUNCEMENT CONSOLE (SUPER ADMIN HERO VIEW)
   ========================================================================== */

.pa-console {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent-live);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
}

.pa-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

@media (max-width: 600px) {
  .pa-hero-grid {
    grid-template-columns: 1fr;
  }
}

.btn-pa-big {
  font-family: var(--font-sans);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 1.15rem 0.85rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  min-height: 84px;
}

.btn-pa-big:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
}

.btn-pa-big:active {
  transform: scale(0.98);
}

.btn-pa-big.live-ptt {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #ff6b6b;
}

.btn-pa-big.live-ptt:hover {
  background: rgba(239, 68, 68, 0.16);
}

.btn-pa-big.is-recording {
  background: var(--accent-live) !important;
  color: #ffffff !important;
  border-color: var(--accent-live) !important;
}

.pa-status-banner {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  display: none;
  align-items: center;
  justify-content: space-between;
}

.pa-preview-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-top: 0.75rem;
  display: none;
}

/* ==========================================================================
   ZONE SPEAKER & AMPLIFIER RELAY MATRIX
   ========================================================================== */

.zone-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 640px) {
  .zone-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.zone-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.zone-card:hover {
  border-color: var(--border-focus);
}

.zone-card:active {
  transform: scale(0.97);
}

.zone-card.active {
  border-color: var(--accent-active);
  background: rgba(16, 185, 129, 0.08);
}

.zone-card.muted {
  border-color: var(--accent-live);
  background: rgba(239, 68, 68, 0.08);
  opacity: 0.85;
}

.zone-name {
  font-size: 0.76rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

.zone-state-text {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-top: 3px;
  display: block;
}

.zone-card.active .zone-state-text {
  color: var(--accent-active);
}

.zone-card.muted .zone-state-text {
  color: var(--accent-live);
}

/* Zone Header Actions & Rename Popover */
.zone-header-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.zone-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 290px;
  max-width: calc(100vw - 2rem);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.65), 0 6px 14px -3px rgba(0, 0, 0, 0.45);
  padding: 0.85rem;
  z-index: 100;
  backdrop-filter: blur(10px);
  animation: popoverFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.zone-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.zone-popover-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.zone-popover-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.zone-popover-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-subtle);
}

.zone-popover-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.zone-popover-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.zone-popover-field label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.zone-popover-field input {
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  width: 100%;
}

.zone-popover-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.6rem;
  margin-top: 0.6rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  .zone-popover {
    position: fixed;
    top: auto;
    bottom: 1.25rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
    z-index: 1000;
  }
}

.amp-hardware-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   MEDIA PLAYER CONSOLE & CONTROLS
   ========================================================================== */

.player-main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.track-headline {
  font-size: clamp(1rem, 3.8vw, 1.35rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 0.35rem;
  word-break: break-word;
  line-height: 1.3;
}

.player-button-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn-ctrl {
  font-family: var(--font-sans);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  /* Touch friendly */
  transition: background 0.15s, transform 0.05s;
}

.btn-ctrl:hover {
  background: var(--bg-surface-elevated);
}

.btn-ctrl:active {
  transform: scale(0.97);
}

.btn-play-pause {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.btn-play-pause:hover {
  background: var(--accent-primary-hover);
}

/* ==========================================================================
   MASTER VOLUME STUDIO HARDWARE FADER
   ========================================================================== */

.master-fader-container {
  margin-top: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.master-fader-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.master-fader-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fader-vol-badge {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.fader-track-bay {
  position: relative;
  padding: 0.25rem 0;
}

input[type="range"].horizontal-fader {
  --fader-fill: 60%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  outline: none;
  cursor: default;
  margin: 0;
  touch-action: pan-y;
}

input[type="range"].horizontal-fader:active {
  cursor: default;
}

/* WebKit Track with Dynamic Hardware Level Fill */
input[type="range"].horizontal-fader::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--accent-primary) 0%,
    var(--accent-primary) var(--fader-fill, 60%),
    var(--fader-track-bg) var(--fader-fill, 60%),
    var(--fader-track-bg) 100%
  );
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Firefox Track */
input[type="range"].horizontal-fader::-moz-range-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--fader-track-bg);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

input[type="range"].horizontal-fader::-moz-range-progress {
  height: 8px;
  border-radius: 4px 0 0 4px;
  background: var(--accent-primary);
}

/* WebKit Thumb: Sleek Milled Console Fader Knob */
input[type="range"].horizontal-fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 18px;
  border-radius: 3px;
  background: 
    linear-gradient(to right, transparent calc(50% - 0.75px), var(--fader-notch) calc(50% - 0.75px), var(--fader-notch) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    var(--fader-thumb-bg);
  border: 1px solid var(--fader-thumb-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  margin-top: -5px; /* (8 - 18) / 2 = -5px */
  transition: transform 0.08s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"].horizontal-fader::-webkit-slider-thumb:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

input[type="range"].horizontal-fader::-webkit-slider-thumb:active {
  transform: scale(1.06);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25), 0 2px 6px rgba(0, 0, 0, 0.7);
}

/* Firefox Thumb */
input[type="range"].horizontal-fader::-moz-range-thumb {
  width: 24px;
  height: 18px;
  border-radius: 3px;
  background: 
    linear-gradient(to right, transparent calc(50% - 0.75px), var(--fader-notch) calc(50% - 0.75px), var(--fader-notch) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    var(--fader-thumb-bg);
  border: 1px solid var(--fader-thumb-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: default;
  transition: transform 0.08s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"].horizontal-fader::-moz-range-thumb:active {
  transform: scale(1.06);
  border-color: var(--accent-primary);
  cursor: default;
}

.fader-scale-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 8px;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* ==========================================================================
   TABLE & COMPACT ROW SLIDERS
   ========================================================================== */

.table-slider-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

input[type="range"].table-slider {
  --slider-fill: 60%;
  -webkit-appearance: none;
  appearance: none;
  width: 96px;
  height: 22px;
  background: transparent;
  outline: none;
  cursor: default;
  margin: 0;
  touch-action: pan-y;
}

/* WebKit Track: Clean recessed studio slot with dynamic level fill */
input[type="range"].table-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--accent-primary) 0%,
    var(--accent-primary) var(--slider-fill, 60%),
    var(--fader-track-bg) var(--slider-fill, 60%),
    var(--fader-track-bg) 100%
  );
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* Firefox Track */
input[type="range"].table-slider::-moz-range-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--fader-track-bg);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

input[type="range"].table-slider::-moz-range-progress {
  height: 6px;
  border-radius: 3px 0 0 3px;
  background: var(--accent-primary);
}

/* WebKit Thumb: Same Milled Console Fader Knob, Slender & Less Bulky (11x16mm cap) */
input[type="range"].table-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 16px;
  border-radius: 2px;
  background: 
    linear-gradient(to right, transparent calc(50% - 0.75px), var(--fader-notch) calc(50% - 0.75px), var(--fader-notch) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    var(--fader-thumb-bg);
  border: 1px solid var(--fader-thumb-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  margin-top: -5px; /* (6 - 16) / 2 = -5px */
  cursor: default;
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

input[type="range"].table-slider::-webkit-slider-thumb:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

input[type="range"].table-slider::-webkit-slider-thumb:active {
  transform: scale(1.08);
  border-color: var(--accent-primary);
  cursor: default;
}

/* Firefox Thumb: Matching Milled Console Fader Knob */
input[type="range"].table-slider::-moz-range-thumb {
  width: 11px;
  height: 16px;
  border-radius: 2px;
  background: 
    linear-gradient(to right, transparent calc(50% - 0.75px), var(--fader-notch) calc(50% - 0.75px), var(--fader-notch) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    var(--fader-thumb-bg);
  border: 1px solid var(--fader-thumb-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: default;
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

input[type="range"].table-slider::-moz-range-thumb:active {
  transform: scale(1.08);
  border-color: var(--accent-primary);
  cursor: default;
}

.table-slider-val {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* Legacy fader row wrapper fallback */
.fader-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
}

/* ==========================================================================
   10-BAND GRAPHIC EQUALIZER (STUDIO HARDWARE RACK)
   ========================================================================== */

.eq-rack {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.85rem 0.4rem 0.55rem 0.4rem;
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  scrollbar-width: thin;
}

.eq-channel {
  flex: 1;
  min-width: 58px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.25rem 0.5rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: border-color 0.15s ease;
}

.eq-channel:hover {
  border-color: var(--border-focus);
}

.eq-slot-bay {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 140px;
  width: 100%;
}

/* Reference Decibel Legend along channel slot */
.eq-scale-legend {
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-size: 0.54rem;
  color: var(--text-muted);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
  padding: 6px 0;
}

/* 0dB (Unity Gain) Detent Reference Line across bay */
.eq-zero-line {
  position: absolute;
  top: 50%;
  left: 6px;
  right: 6px;
  height: 1px;
  background: var(--border-focus);
  opacity: 0.8;
  pointer-events: none;
  z-index: 1;
}

/* Vertical Studio Fader Input */
.eq-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  appearance: none;
  -webkit-appearance: none;
  touch-action: none !important;
  width: 28px;
  height: 130px;
  background: transparent;
  outline: none;
  cursor: default;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 2;
}

.eq-slider:active {
  cursor: default;
}

/* WebKit Vertical Track */
.eq-slider::-webkit-slider-runnable-track {
  width: 6px;
  height: 130px;
  background: var(--fader-track-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Firefox Vertical Track */
.eq-slider::-moz-range-track {
  width: 6px;
  height: 130px;
  background: var(--fader-track-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* WebKit Thumb: Sleek Studio Fader Cap on Vertical Slot */
.eq-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 12px;
  border-radius: 2px;
  background: 
    linear-gradient(to bottom, transparent calc(50% - 0.75px), var(--fader-notch) calc(50% - 0.75px), var(--fader-notch) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    var(--fader-thumb-bg);
  border: 1px solid var(--fader-thumb-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: default;
  margin-left: -8px; /* (6 - 22) / 2 = -8px centers the 22px thumb over 6px track */
  transition: transform 0.08s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.eq-slider::-webkit-slider-thumb:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.eq-slider::-webkit-slider-thumb:active {
  transform: scale(1.08);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3), 0 2px 6px rgba(0, 0, 0, 0.7);
  cursor: default;
}

/* Firefox Thumb */
.eq-slider::-moz-range-thumb {
  width: 22px;
  height: 12px;
  border-radius: 2px;
  background: 
    linear-gradient(to bottom, transparent calc(50% - 0.75px), var(--fader-notch) calc(50% - 0.75px), var(--fader-notch) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    var(--fader-thumb-bg);
  border: 1px solid var(--fader-thumb-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: default;
  transition: transform 0.08s ease, border-color 0.15s ease;
}

.eq-slider::-moz-range-thumb:active {
  transform: scale(1.08);
  border-color: var(--accent-primary);
  cursor: default;
}

/* Frequency Channel Badge */
.eq-freq-label {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.45rem;
  letter-spacing: 0.02em;
}

/* Live Dynamic Decibel Readout */
.eq-db-label {
  font-size: 0.64rem;
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  padding: 1px 4px;
  border-radius: 2px;
  transition: color 0.12s ease;
}

.eq-db-label.eq-boost {
  color: #60a5fa; /* Vibrant blue for boost */
  font-weight: 700;
}

.eq-db-label.eq-cut {
  color: #34d399; /* Emerald green for cut/attenuation */
  font-weight: 700;
}

.eq-db-label.eq-flat {
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   EQUALIZER GRAPH CONTAINER (LOCKED RESPONSE CURVE)
   ========================================================================== */

.eq-graph-container {
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.65rem 0.45rem 0.65rem;
  margin-top: 0.35rem;
  overflow: hidden;
  position: relative;
  touch-action: pan-y !important; /* Mobile vertical swipe/scroll safety */
}

.eq-curve-svg {
  width: 100%;
  height: 250px;
  display: block;
  user-select: none;
  touch-action: pan-y !important;
}

@media (max-width: 640px) {
  .eq-curve-svg {
    height: 215px;
  }
}

/* Enforce Standard Arrow Cursor on ALL Range Sliders (No Hand / Grab Icons) */
input[type="range"],
input[type="range"]::-webkit-slider-thumb,
input[type="range"]::-webkit-slider-runnable-track,
input[type="range"]::-moz-range-thumb,
input[type="range"]::-moz-range-track,
.horizontal-fader,
.table-slider,
.eq-slider {
  cursor: default !important;
}

/* ==========================================================================
   TABLES & SCHEDULES
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
  text-align: left;
  min-width: 580px;
  /* Ensures columns stay legible on mobile */
}

th {
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr.schedule-row-active td {
  background: rgba(16, 185, 129, 0.06);
}

[data-theme="light"] tr.schedule-row-active td {
  background: rgba(16, 185, 129, 0.08);
}

/* Form Controls */
select.form-select,
input.form-input {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  outline: none;
  min-height: 32px;
  font-family: var(--font-sans);
}

select.form-select:focus,
input.form-input:focus {
  border-color: var(--accent-primary);
}

/* Day & Zone Pills */
.pill-group {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}

.toggle-pill {
  font-family: var(--font-sans);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 26px;
  min-width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toggle-pill.active {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: #ffffff !important;
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  border-radius: 20px;
  transition: 0.15s;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: 0.15s;
}

input:checked+.slider-toggle {
  background-color: var(--accent-active);
}

input:checked+.slider-toggle:before {
  transform: translateX(16px);
}

/* Buttons */
.btn-action-primary {
  font-family: var(--font-sans);
  background: var(--accent-active);
  color: #ffffff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.74rem;
  cursor: pointer;
  min-height: 32px;
  transition: opacity 0.15s, transform 0.05s;
}

.btn-action-primary:active {
  transform: scale(0.97);
}

.btn-action-secondary {
  font-family: var(--font-sans);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.74rem;
  cursor: pointer;
  min-height: 32px;
  transition: background 0.15s, transform 0.05s;
}

.btn-action-secondary:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.btn-action-secondary:active {
  transform: scale(0.97);
}

.btn-delete {
  font-family: var(--font-sans);
  background: transparent;
  color: var(--accent-live);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  cursor: pointer;
  min-height: 28px;
  transition: background 0.15s;
}

.btn-delete:hover {
  background: var(--accent-live);
  color: #ffffff;
}

button:disabled,
.btn-action-primary:disabled,
.btn-action-secondary:disabled,
.btn-delete:disabled {
  opacity: 0.4;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
}

/* File Upload & Library */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-surface-subtle);
  transition: border-color 0.15s;
}

.drop-zone:hover {
  border-color: var(--accent-primary);
}

.file-list-box {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  margin-top: 0.5rem;
}

.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
}

.file-row:last-child {
  border-bottom: none;
}

/* Drawer / Collapsible for Super Admin */
.technical-drawer {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.technical-drawer.collapsible-closed {
  display: none !important;
}

/* Audio Player Element */
audio {
  min-height: 44px;
}