* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a1a2e;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==================== HEADER ==================== */

header {
  background: #16213e;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #0f3460;
}

body.login-mode header {
  display: none;
}

h1 {
  font-size: 1.5rem;
  color: #e94560;
}

.status {
  display: flex;
  gap: 20px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #555;
}

.status-dot.connected {
  background: #4ade80;
  box-shadow: 0 0 10px #4ade80;
}

.status-dot.connecting {
  background: #fbbf24;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ==================== MAIN ==================== */

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* ==================== SCREENS ==================== */

.screen {
  display: none;
  width: 100%;
  max-width: 900px;
}

.screen.active {
  display: block;
}

.screen-title {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: #888;
}

.screen-title span {
  color: #e94560;
}

/* ==================== CARDS ==================== */

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

.card {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.card:hover {
  border-color: #e94560;
  transform: translateY(-2px);
}

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

.card.disabled:hover {
  border-color: #0f3460;
  transform: none;
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-online {
  background: #065f46;
  color: #4ade80;
}

.badge-offline {
  background: #7f1d1d;
  color: #f87171;
}

.badge-ready {
  background: #065f46;
  color: #4ade80;
}

.badge-busy {
  background: #78350f;
  color: #fbbf24;
}

.badge-empty {
  background: #374151;
  color: #9ca3af;
}

.badge-error {
  background: #7f1d1d;
  color: #f87171;
}

.badge-needs-config {
  background: #78350f;
  color: #fbbf24;
}

.station-gear-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  vertical-align: middle;
}

.station-gear-btn:hover {
  color: #e94560;
}

.slot-alert {
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(234, 69, 96, 0.1);
  border: 1px solid rgba(234, 69, 96, 0.3);
  border-radius: 4px;
  font-size: 0.8rem;
  color: #f87171;
}

.slot-alert div {
  margin: 2px 0;
}

.station-warning {
  color: #fbbf24;
  font-size: 0.75rem;
  margin-top: 4px;
}

.card-info {
  font-size: 0.85rem;
  color: #888;
}

.card-info div {
  margin: 4px 0;
}

.card-info strong {
  color: #aaa;
}

/* ==================== BUTTONS ==================== */

.back-btn {
  background: transparent;
  border: 1px solid #0f3460;
  color: #888;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.back-btn:hover {
  border-color: #e94560;
  color: #eee;
}

.end-session-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #dc2626;
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.end-session-btn:hover {
  background: #b91c1c;
}

.fullscreen-btn {
  position: absolute;
  bottom: 10px;
  right: 130px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #444;
  color: white;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-btn svg {
  width: 20px;
  height: 20px;
}

.fullscreen-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: #e94560;
}

/* Fullscreen mode */
.video-container:fullscreen,
.video-container:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container:fullscreen video,
.video-container:-webkit-full-screen video {
  /* Upscale to fill screen while maintaining aspect ratio */
  width: 100%;
  height: 100%;
  object-fit: contain;  /* contain = keep aspect ratio, cover = fill & crop */
  /* Smooth upscaling (reduces pixelation on large screens) */
  image-rendering: auto;  /* auto = smooth, pixelated = sharp pixels */
}

.video-container:fullscreen .no-video,
.video-container:-webkit-full-screen .no-video {
  width: 100%;
  height: 100%;
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ==================== VIDEO ==================== */

.video-container {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(233, 69, 96, 0.3);
}

video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 200px);
}

.video-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: monospace;
}

.drone-info-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.drone-info-overlay .drone-name {
  color: #e94560;
  font-weight: 600;
}

.no-video {
  width: 640px;
  height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #0a0a15;
  color: #666;
}

.no-video svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

/* ==================== FOOTER ==================== */

footer {
  background: #16213e;
  padding: 10px 20px;
  text-align: center;
  font-size: 0.8rem;
  color: #666;
  border-top: 1px solid #0f3460;
}

footer.hidden {
  display: none;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.stat {
  font-family: monospace;
}

.stat-label {
  color: #888;
}

.telemetry-row {
  border-top: 1px solid #333;
  padding-top: 5px;
  gap: 20px;
}

.telemetry-row .stat-label {
  color: #e94560;
}

.stat-value {
  color: #4ade80;
}

/* Adaptive strategy buttons (reuse setting-btn style in settings panel) */
.adapt-btn {
  background: #0f3460;
  border: 1px solid #1a4980;
  color: #888;
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 600;
}

.adapt-btn:hover {
  border-color: #e94560;
  color: #eee;
}

.adapt-btn.active {
  background: #e94560;
  border-color: #e94560;
  color: #fff;
}

/* ==================== PRE-FLIGHT CHECK ==================== */

.preflight-section {
  margin-top: 24px;
  text-align: center;
}

.preflight-btn {
  background: #0f3460;
  border: 2px solid #1a4980;
  color: #eee;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}

.preflight-btn:hover {
  border-color: #e94560;
  color: #e94560;
}

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

.preflight-result {
  margin-top: 16px;
  padding: 16px 20px;
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 8px;
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.preflight-result .preflight-title {
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.preflight-result .preflight-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.85rem;
  font-family: monospace;
}

.preflight-result .preflight-row .label {
  color: #888;
}

.preflight-result .preflight-verdict {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 4px;
  font-weight: 600;
  text-align: center;
  font-size: 0.9rem;
}

.preflight-verdict.good {
  background: #065f46;
  color: #4ade80;
  border: 1px solid #4ade80;
}

.preflight-verdict.warn {
  background: #78350f;
  color: #fbbf24;
  border: 1px solid #fbbf24;
}

.preflight-verdict.bad {
  background: #7f1d1d;
  color: #f87171;
  border: 1px solid #f87171;
}

/* ==================== DIAGNOSTIC PANEL ==================== */

.diag-progress {
  margin-top: 16px;
  padding: 12px 16px;
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 8px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.diag-progress-bar {
  height: 4px;
  background: #0f3460;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}

.diag-progress-bar::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--progress, 0%);
  background: #e94560;
  border-radius: 2px;
  transition: width 0.3s;
}

.diag-phase {
  font-size: 0.8rem;
  color: #888;
  font-family: monospace;
  text-align: center;
}

.diag-results {
  margin-top: 16px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.diag-section {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.diag-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.diag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 0.85rem;
  font-family: monospace;
}

.diag-row .label {
  color: #888;
}

.diag-row .value {
  font-weight: 600;
}

.diag-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diag-bar-track {
  width: 100px;
  height: 8px;
  background: #0f3460;
  border-radius: 4px;
  overflow: hidden;
}

.diag-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.diag-rec {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-top: 4px;
}

.diag-rec.good {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.diag-rec.info {
  background: rgba(96, 165, 250, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.diag-rec.warn {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.diag-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #7f1d1d;
  border: 1px solid #f87171;
  border-radius: 8px;
  color: #f87171;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.85rem;
  text-align: center;
}

/* ==================== GAMEPAD PANEL ==================== */

.gamepad-panel {
  margin-top: 30px;
  padding: 20px;
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 8px;
}

/* Not connected state */
.gamepad-not-connected {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px;
}

.gamepad-icon {
  color: #666;
  margin-bottom: 12px;
}

.gamepad-message {
  font-size: 1rem;
  color: #888;
  margin-bottom: 16px;
}

.gamepad-activate-btn {
  background: #e94560;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.gamepad-activate-btn:hover {
  background: #d63a54;
}

.gamepad-activate-btn:active {
  transform: scale(0.98);
}

.gamepad-hint {
  font-size: 0.8rem;
  color: #555;
  margin-top: 12px;
}

/* Connected state */
.gamepad-connected {
  padding: 5px;
}

.gamepad-connected-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #0f3460;
}

.gamepad-connected-icon {
  width: 36px;
  height: 36px;
  background: #065f46;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4ade80;
}

.gamepad-connected-label {
  font-size: 0.8rem;
  color: #4ade80;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gamepad-connected-name {
  font-size: 0.95rem;
  color: #ccc;
  margin-top: 2px;
}

.gamepad-values {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .gamepad-values {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gamepad-value-group {
  background: #0f3460;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
}

.gamepad-value-label {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.gamepad-value {
  font-family: monospace;
  font-size: 1.1rem;
  color: #4ade80;
  font-weight: 600;
}

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

.login-container {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin: 0 auto;
}

.login-logo {
  font-size: 2.5rem;
  font-weight: 700;
  color: #e94560;
  margin-bottom: 8px;
}

.login-subtitle {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: #0f3460;
  border: 2px solid #1a4980;
  border-radius: 6px;
  color: #eee;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #e94560;
}

.form-group input::placeholder {
  color: #555;
}

.login-error {
  color: #f87171;
  font-size: 0.85rem;
  min-height: 20px;
}

.login-btn {
  background: #e94560;
  border: none;
  padding: 14px 24px;
  border-radius: 6px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
  background: #d63a54;
}

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

.login-btn:disabled {
  background: #555;
  cursor: not-allowed;
}

/* ==================== ADMIN PANEL ==================== */

.admin-header, .stations-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.admin-btn {
  background: #0f3460;
  border: 1px solid #1a4980;
  color: #e94560;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-btn:hover {
  background: #1a4980;
  border-color: #e94560;
}

.admin-section {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.section-header {
  margin-bottom: 16px;
}

.section-header h3 {
  color: #e94560;
  font-size: 1.1rem;
}

.create-token-form .form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.create-token-form .form-group {
  flex: 1;
  min-width: 180px;
}

.create-token-form .form-group label {
  display: block;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 6px;
}

.create-token-form .form-group input {
  width: 100%;
  padding: 10px 14px;
  background: #0f3460;
  border: 2px solid #1a4980;
  border-radius: 6px;
  color: #eee;
  font-size: 0.95rem;
}

.create-token-form .form-group input:focus {
  outline: none;
  border-color: #e94560;
}

.btn-primary {
  background: #e94560;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:hover {
  background: #d63a54;
}

.new-token-display {
  margin-top: 16px;
  padding: 16px;
  background: #0f3460;
  border-radius: 6px;
  border: 2px solid #4ade80;
}

.token-warning {
  color: #fbbf24;
  font-size: 0.85rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.token-value {
  font-family: monospace;
  font-size: 0.9rem;
  color: #4ade80;
  background: #1a1a2e;
  padding: 12px;
  border-radius: 4px;
  word-break: break-all;
  margin-bottom: 10px;
}

.btn-copy {
  background: #065f46;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  color: #4ade80;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-copy:hover {
  background: #047857;
}

.tokens-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.token-card {
  background: #0f3460;
  border-radius: 6px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.token-card.revoked {
  opacity: 0.5;
  border: 1px solid #7f1d1d;
}

.token-info {
  flex: 1;
  min-width: 200px;
}

.token-station-name {
  font-weight: 600;
  font-size: 1rem;
  color: #eee;
  margin-bottom: 4px;
}

.token-station-id {
  font-size: 0.85rem;
  color: #888;
  font-family: monospace;
}

.token-meta {
  font-size: 0.8rem;
  color: #666;
  margin-top: 6px;
}

.token-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.online {
  background: #065f46;
  color: #4ade80;
}

.status-badge.offline {
  background: #374151;
  color: #9ca3af;
}

.status-badge.revoked {
  background: #7f1d1d;
  color: #f87171;
}

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

.btn-action {
  background: #1a4980;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  color: #eee;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-action:hover {
  background: #2563eb;
}

.btn-action.danger {
  background: #7f1d1d;
  color: #f87171;
}

.btn-action.danger:hover {
  background: #991b1b;
}

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

/* ==================== STATION CONFIG UI ==================== */

.config-station-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.config-station-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.config-station-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #eee;
}
.config-station-name-input {
  font-size: 1.1rem;
  font-weight: 600;
  color: #eee;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 6px;
  outline: none;
  transition: border-color 0.2s;
}
.config-station-name-input:hover,
.config-station-name-input:focus {
  border-color: #4a90d9;
  background: rgba(255,255,255,0.05);
}

.config-station-id {
  font-family: monospace;
  font-size: 0.85rem;
  color: #888;
}

.config-station-hw {
  font-size: 0.8rem;
  color: #e94560;
  background: rgba(233, 69, 96, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.config-station-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.config-station-wg {
  font-family: monospace;
  font-size: 0.85rem;
  color: #4ade80;
}

.config-usb-devices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.usb-device-card {
  background: #0f3460;
  border-radius: 6px;
  padding: 12px;
}

.usb-device-name {
  font-weight: 600;
  color: #eee;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.usb-device-info {
  font-family: monospace;
  font-size: 0.75rem;
  color: #888;
}

.usb-device-info div {
  margin: 2px 0;
}

.usb-device-type {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 4px;
}

.usb-device-type.video { background: #1e3a5f; color: #60a5fa; }
.usb-device-type.serial { background: #3f3a1e; color: #fbbf24; }
.usb-device-type.unknown { background: #374151; color: #9ca3af; }

.config-group {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #0f3460;
}

.config-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.config-group-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e94560;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.config-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.config-field {
  display: flex;
  flex-direction: column;
}

.config-field label {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 6px;
}

.config-field input[type="text"],
.config-field input[type="number"],
.config-field select {
  width: 100%;
  padding: 8px 12px;
  background: #0f3460;
  border: 2px solid #1a4980;
  border-radius: 6px;
  color: #eee;
  font-size: 0.9rem;
}

.config-field input:focus,
.config-field select:focus {
  outline: none;
  border-color: #e94560;
}

.config-checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #eee;
  font-size: 0.9rem;
  margin-top: 16px;
}

.config-checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #e94560;
}

.config-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.config-range-row input[type="range"] {
  flex: 1;
  accent-color: #e94560;
}

.config-range-value {
  font-family: monospace;
  font-size: 0.85rem;
  color: #4ade80;
  min-width: 50px;
  text-align: right;
}

.config-channel-map {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-map-row {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #0f3460;
  padding: 8px 12px;
  border-radius: 6px;
}

.channel-map-row input[type="text"] {
  flex: 1;
  min-width: 80px;
  padding: 6px 10px;
  background: #1a1a2e;
  border: 1px solid #1a4980;
  border-radius: 4px;
  color: #eee;
  font-size: 0.85rem;
}

.channel-map-row input[type="number"] {
  width: 60px;
  padding: 6px 10px;
  background: #1a1a2e;
  border: 1px solid #1a4980;
  border-radius: 4px;
  color: #eee;
  font-size: 0.85rem;
  text-align: center;
}

.channel-map-row select {
  padding: 6px 8px;
  background: #1a1a2e;
  border: 1px solid #1a4980;
  border-radius: 4px;
  color: #eee;
  font-size: 0.85rem;
}

.channel-map-row .channel-label {
  font-size: 0.8rem;
  color: #888;
  min-width: 45px;
}

.channel-map-row .btn-action.danger {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.config-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 16px 0;
}

.config-save-status {
  font-size: 0.85rem;
  color: #4ade80;
}

.config-save-status.error {
  color: #f87171;
}

/* Station list cards in admin */
.station-db-card {
  background: #0f3460;
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.station-db-info {
  flex: 1;
  min-width: 200px;
}

.station-db-name {
  font-weight: 600;
  font-size: 1rem;
  color: #eee;
}

.station-db-meta {
  font-size: 0.8rem;
  color: #888;
  font-family: monospace;
  margin-top: 4px;
}

/* ==================== RECORDING ==================== */

.rec-btn {
  position: absolute;
  bottom: 10px;
  right: 200px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #444;
  color: #ccc;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.rec-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: #e94560;
}

.rec-btn.rec-active {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
  animation: pulse 1s infinite;
}

.recording-indicator {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 10;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc2626;
  animation: pulse 1s infinite;
}

.rec-label {
  color: #dc2626;
  font-weight: 600;
}

.rec-timer {
  color: #eee;
  font-family: monospace;
}

.rec-mic {
  background: #065f46;
  color: #4ade80;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ==================== SETTINGS PANEL ==================== */

.settings-panel {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 0 0 8px 8px;
  margin-top: -1px;
}

.settings-header {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #888;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.settings-header:hover {
  color: #eee;
}

.settings-toggle {
  transition: transform 0.2s;
  font-size: 0.75rem;
}

.settings-toggle.open {
  transform: rotate(90deg);
}

.settings-body {
  padding: 8px 14px 14px;
  border-top: 1px solid #0f3460;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.setting-label {
  font-size: 0.8rem;
  color: #888;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}

.setting-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0f3460;
  color: #666;
  font-size: 0.65rem;
  cursor: help;
  flex-shrink: 0;
  position: relative;
}

.setting-tooltip:hover {
  background: #1a4980;
  color: #eee;
}

.setting-tooltip:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #1a1a2e;
  border: 1px solid #1a4980;
  color: #ccc;
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: normal;
  width: 240px;
  z-index: 100;
  pointer-events: none;
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.setting-control-range {
  flex: 1;
  min-width: 0;
}

.setting-btn {
  background: #0f3460;
  border: 1px solid #1a4980;
  color: #888;
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 600;
}

.setting-btn:hover {
  border-color: #e94560;
  color: #eee;
}

.setting-btn.active {
  background: #e94560;
  border-color: #e94560;
  color: #fff;
}

.setting-range {
  width: 120px;
  accent-color: #e94560;
  cursor: pointer;
}

.setting-range:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.setting-value {
  font-family: monospace;
  font-size: 0.75rem;
  color: #4ade80;
  min-width: 60px;
  text-align: right;
}

.range-label {
  font-family: monospace;
  font-size: 0.65rem;
  color: #555;
}

/* Hide settings panel in fullscreen */
.video-container:fullscreen + .settings-panel,
.video-container:-webkit-full-screen + .settings-panel {
  display: none;
}

/* ==================== UPLOAD OVERLAY ==================== */

.upload-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  border-top: 2px solid #e94560;
}

.upload-progress-bar {
  width: 100%;
  max-width: 400px;
  height: 6px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: #e94560;
  border-radius: 3px;
  transition: width 0.3s;
}

.upload-text {
  color: #eee;
  font-size: 0.9rem;
}

.upload-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.upload-overlay.upload-complete {
  border-top-color: #4ade80;
}

.upload-overlay.upload-complete .upload-progress-fill {
  background: #4ade80;
}

.upload-overlay.upload-complete .upload-text {
  color: #4ade80;
}

.upload-overlay.upload-error {
  border-top-color: #f87171;
}

.upload-overlay.upload-error .upload-progress-fill {
  background: #f87171;
}

.upload-overlay.upload-error .upload-text {
  color: #f87171;
}

.upload-link-btn {
  background: #065f46;
  color: #4ade80;
  padding: 6px 14px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.upload-link-btn:hover {
  background: #047857;
}

.upload-dismiss-btn {
  background: #374151;
  border: none;
  color: #eee;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.upload-dismiss-btn:hover {
  background: #4b5563;
}

.upload-retry-btn {
  background: #7f1d1d;
  border: none;
  color: #f87171;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.upload-retry-btn:hover {
  background: #991b1b;
}
