/* ==========================================================================
   RiderComms Premium Dark CSS Style Sheet
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121c;
  --bg-tertiary: #1b1b2a;
  --accent-orange: #ff5722;
  --accent-orange-hover: #ff7043;
  --accent-green: #00e676;
  --accent-green-bg: rgba(0, 230, 118, 0.15);
  --accent-blue: #00b0ff;
  --accent-blue-bg: rgba(0, 176, 255, 0.1);
  --accent-red: #ff1744;
  --accent-yellow: #ffd600;
  
  --text-primary: #ffffff;
  --text-secondary: #9fa0a7;
  --text-muted: #5e606a;
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(255, 87, 34, 0.4);
  
  /* Glassmorphism */
  --glass-bg: rgba(18, 18, 28, 0.75);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-blur: blur(16px);
  
  /* Layout Settings */
  --shadow-main: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --header-height: 70px;
}

/* ==========================================================================
   Base Elements
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-drag: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden; /* App runs as full screen viewport */
  position: fixed;
  width: 100%;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* App shell */
#app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* ==========================================================================
   Typography & Headers
   ========================================================================== */
h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

a {
  color: var(--accent-orange);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--accent-orange-hover);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
header {
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  flex-shrink: 0;
}

.header-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.logo-accent {
  color: var(--accent-orange);
}

.nav-tabs {
  display: flex;
  gap: 8px;
  height: 100%;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  cursor: pointer;
  height: 100%;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.02);
}

.nav-btn.active {
  color: var(--accent-orange);
  border-bottom-color: var(--accent-orange);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-tertiary);
  padding: 6px 12px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--bg-primary);
}

.user-name {
  font-weight: 500;
  font-size: 0.9rem;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}
.logout-btn:hover {
  color: var(--accent-red);
}

/* ==========================================================================
   Buttons (Touch Targets Min 48px)
   ========================================================================== */
.btn {
  min-height: 48px;
  padding: 8px 20px;
  border-radius: 12px;
  border: none;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

.btn-icon-only {
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
}

.btn-compact {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-large {
  min-height: 56px;
  padding: 12px 28px;
  font-size: 1.05rem;
  width: 100%;
}

.btn-primary {
  background-color: var(--accent-orange);
  color: var(--text-primary);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-orange-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background-color: var(--accent-red);
  color: var(--text-primary);
}
.btn-danger:hover {
  background-color: #ff335c;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control {
  min-height: 48px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 8px 16px;
  font-family: var(--font-family);
  font-size: 1rem;
  transition: border-color 0.2s;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-orange);
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.input-append {
  display: flex;
  gap: 8px;
}
.input-append input {
  flex-grow: 1;
}

/* Customized Range Sliders with big thumbs for motorcycle usage */
.slider-control {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  outline: none;
  margin: 15px 0;
}

.slider-control::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px; /* Extra large thumb for gloved fingers */
  height: 32px;
  border-radius: 50%;
  background: var(--accent-orange);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  border: 2px solid white;
}

.slider-control::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-orange);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  border: 2px solid white;
}

.label-with-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-badge {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-orange);
}

/* Toggle Switch Control */
.toggle-control {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 12px;
  position: relative;
}

.toggle-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  background-color: var(--bg-tertiary);
  border-radius: 34px;
  transition: .4s;
  border: 1px solid var(--border-color);
  margin-right: 12px;
  flex-shrink: 0;
}

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

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

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

.toggle-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  text-transform: none;
}

/* ==========================================================================
   Screens & Container Systems
   ========================================================================== */
.screen {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: none;
  width: 100%;
}

.screen.active {
  display: block;
}

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-shrink: 0;
}

/* Hidden elements */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Screen 1: Login Screen Design
   ========================================================================== */
#screen-login {
  background: radial-gradient(circle at center, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-main);
  backdrop-filter: var(--glass-blur);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 40px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-brand {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}
.brand-rider {
  color: var(--accent-orange);
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 36px;
}

.login-illustration {
  margin-bottom: 40px;
}

.helmet-pulse {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.helmet-icon {
  font-size: 44px;
  color: var(--accent-orange);
  z-index: 10;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--accent-orange);
  animation: keyframe-pulse 2.5s infinite linear;
  opacity: 0;
}
.ring-2 {
  animation-delay: 1.25s;
}

@keyframes keyframe-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

.login-actions {
  width: 100%;
}

.google-svg {
  margin-right: 12px;
  background-color: white;
  border-radius: 50%;
  padding: 2px;
}

.login-footer-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ==========================================================================
   Screen 2: Channels List Screen
   ========================================================================== */
.channels-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.channels-section h2 {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.channel-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.channel-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 87, 34, 0.3);
  box-shadow: var(--shadow-main);
}

.channel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.channel-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

.channel-badges {
  display: flex;
  gap: 4px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge-pinned {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge-bridge {
  background-color: var(--accent-blue-bg);
  color: var(--accent-blue);
  border: 1px solid rgba(0, 176, 255, 0.3);
}

.channel-card-body {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.rider-count-icon {
  font-size: 18px;
  color: var(--text-muted);
}

.rider-count-text {
  font-size: 0.9rem;
}

.channel-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.card-action-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-orange);
}

.card-lock-icon {
  font-size: 18px;
  color: var(--text-muted);
}

/* ==========================================================================
   Screen 3: Active Room Screen (Room Layout)
   ========================================================================== */
.room-layout {
  display: flex;
  flex-direction: column;
  padding: 16px !important;
  height: 100%;
}

.bridge-banner {
  background-color: var(--accent-blue-bg);
  border: 1px solid rgba(0, 176, 255, 0.2);
  color: var(--accent-blue);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.pulse-bridge {
  animation: keyframe-bridge-pulse 2s infinite ease-in-out;
}

@keyframes keyframe-bridge-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.room-header-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.room-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-room-icon {
  color: var(--accent-orange);
  font-size: 28px;
}

.connection-quality-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 20px;
}

.quality-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.quality-green { background-color: var(--accent-green); }
.quality-yellow { background-color: var(--accent-yellow); }
.quality-red { background-color: var(--accent-red); }
.quality-unknown { background-color: var(--text-muted); }

.latency-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Split-Pane Viewport (Riders left, Map right) */
.room-split-container {
  display: flex;
  gap: 16px;
  flex-grow: 1;
  min-height: 0; /* Important for flex-grow scrolling */
  margin-bottom: 16px;
}

.riders-list-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  overflow-y: auto;
  min-width: 320px;
}

.riders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

/* Individual Rider Card Visuals (Motorcycle glanceable size) */
.rider-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.rider-card.group-leader-card {
  border-color: rgba(255, 87, 34, 0.4);
}

.leader-badge-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 16px;
  color: var(--accent-yellow);
}

.rider-avatar-wrapper {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
}

.rider-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-secondary);
  background-color: var(--bg-primary);
}

/* Transmitting outer ring */
.rider-avatar-wrapper.voice-transmitting:after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 3px solid var(--accent-green);
  animation: keyframe-mic-pulse 1.5s infinite ease-in-out;
}

@keyframes keyframe-mic-pulse {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7); }
  70% { transform: scale(1.03); opacity: 0.9; box-shadow: 0 0 0 8px rgba(0, 230, 118, 0); }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); }
}

.rider-name-label {
  font-size: 0.95rem;
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.rider-detail-row {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.detail-icon {
  font-size: 12px;
  color: var(--text-muted);
}

/* Embedded map */
.map-panel {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  min-height: 250px;
}

.map-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  padding: 4px 12px 4px 4px;
  border-radius: 30px;
  border: 1px solid var(--glass-border);
}

.map-title-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.embedded-map {
  width: 100%;
  flex-grow: 1;
}

/* Invert Leaflet map tiles slightly for dark theme styling */
.leaflet-container {
  background-color: #1a1a24 !important;
}
.leaflet-tile-container img {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* Footer Control Area */
.room-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 16px 24px;
  flex-shrink: 0;
}

/* Microphone giant feedback panel */
.own-mic-status {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 10px 24px;
  border-radius: 40px;
  min-width: 200px;
}

.own-mic-status.active-transmitting {
  background-color: var(--accent-green-bg);
  border-color: rgba(0, 230, 118, 0.4);
}
.own-mic-status.active-transmitting .mic-icon {
  color: var(--accent-green);
  animation: keyframe-active-mic-pulse 1.2s infinite ease-in-out;
}
.own-mic-status.active-transmitting .mic-status-text {
  color: var(--accent-green);
}

.mic-icon {
  font-size: 28px;
  color: var(--text-muted);
}

.mic-status-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@keyframes keyframe-active-mic-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.quick-room-actions {
  display: flex;
  gap: 12px;
}

.ios-keepalive-banner {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  flex-shrink: 0;
}
.ios-keepalive-banner span {
  font-size: 14px;
}

/* ==========================================================================
   Screen 4: Settings & Profile
   ========================================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
  align-items: start;
}

.settings-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
}

.full-width-card {
  grid-column: 1 / -1;
}

.profile-info-block {
  display: flex;
  gap: 20px;
  align-items: center;
}

.profile-avatar-wrapper {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--accent-orange);
  overflow: hidden;
  background-color: var(--bg-tertiary);
}
.profile-avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-form {
  flex-grow: 1;
}

.stats-block-container {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.stat-box {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-orange);
}

.stat-lbl {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sub-toggles-container {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  border-left: 2px solid var(--border-color);
  padding-left: 16px;
  gap: 4px;
}

/* ==========================================================================
   Screen 5: Admin Panel Controls
   ========================================================================== */
.admin-subtabs {
  display: flex;
  gap: 6px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px;
  border-radius: 14px;
  margin-bottom: 24px;
  flex-shrink: 0;
  overflow-x: auto;
}

.subtab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px 18px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s;
  white-space: nowrap;
}
.subtab-btn:hover {
  color: var(--text-primary);
}
.subtab-btn.active {
  background-color: var(--accent-orange);
  color: var(--text-primary);
}

.admin-section {
  display: none;
}
.admin-section.active {
  display: block;
}

.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.admin-stat-card .lbl {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.admin-stat-card .val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 6px;
}

.live-stats-chart-area {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-legend {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.in-dot { background-color: var(--accent-blue); }
.out-dot { background-color: var(--accent-orange); }

.canvas-chart {
  width: 100%;
  height: 200px;
  background-color: var(--bg-primary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.admin-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.admin-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
}

.admin-global-map {
  width: 100%;
  height: 400px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-top: 16px;
}

.card-header-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.export-actions {
  display: flex;
  gap: 8px;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}
.inline-form .form-group {
  margin-bottom: 0;
  flex-grow: 1;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-group-row {
  display: flex;
  gap: 12px;
}

.invite-link-copy-container {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.audit-filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background-color: var(--bg-secondary);
}
.audit-filters-bar .form-group {
  margin-bottom: 0;
  min-width: 200px;
}

/* ==========================================================================
   Table Styling
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.max-height-200 {
  max-height: 200px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

.data-table td {
  color: var(--text-primary);
}

.role-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.role-badge.admin {
  background-color: rgba(255, 87, 34, 0.15);
  color: var(--accent-orange);
}
.role-badge.rider {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-main);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 32px;
}

.modal-box h2 {
  margin-bottom: 16px;
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.volume-sliders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  background-color: var(--bg-tertiary);
}

.volume-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.volume-row span {
  font-size: 0.85rem;
  width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.volume-row input {
  flex-grow: 1;
  margin: 0;
}

/* Full Screen Suspension Overlay */
#audio-restore-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 87, 34, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  cursor: pointer;
}

.restore-content {
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.restore-icon {
  font-size: 80px;
  animation: keyframe-restore-pulse 1.5s infinite ease-in-out;
}

@keyframes keyframe-restore-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.error-banner {
  background-color: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.3);
  color: var(--accent-red);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-size: 0.85rem;
}
.error-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  header {
    padding: 0 16px;
  }
  .nav-btn {
    padding: 0 10px;
  }
  .tab-label {
    display: none; /* Hide nav text on small phone screens, keep icons only */
  }
  .user-badge {
    padding: 4px;
  }
  .user-name {
    display: none; /* Hide username label on mobile */
  }
  
  .room-split-container {
    flex-direction: column;
  }
  .riders-list-panel {
    min-height: 220px;
    flex: 1.5;
  }
  .map-panel {
    flex: 1;
    min-height: 180px;
  }
  
  .room-footer-bar {
    padding: 12px 16px;
  }
  
  .own-mic-status {
    min-width: 120px;
    padding: 8px 16px;
  }
  .mic-status-text {
    font-size: 0.9rem;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
