/**
 * wspy-core.css — WespyRadio overrides for Vuexy BS5 theme
 * Loaded AFTER core.css on BS5 pages only
 */

/* ── Zone-aware accent colors ─────────────────────────────── */
:root {
  --wspy-accent-monitoring: #1e93e8;
  --wspy-accent-monitoring-rgb: 30, 147, 232;
  --wspy-accent-desk: #d9091e;
  --wspy-accent-desk-rgb: 217, 9, 30;
}

body.zone-monitoring {
  --bs-primary: var(--wspy-accent-monitoring);
  --bs-primary-rgb: var(--wspy-accent-monitoring-rgb);
  --bs-link-color: var(--wspy-accent-monitoring);
  --bs-link-hover-color: #1a7ec8;
}

body.zone-desk {
  --bs-primary: var(--wspy-accent-desk);
  --bs-primary-rgb: var(--wspy-accent-desk-rgb);
  --bs-link-color: var(--wspy-accent-desk);
  --bs-link-hover-color: #b8081a;
}

body.zone-auth {
  --bs-primary: var(--wspy-accent-monitoring);
  --bs-primary-rgb: var(--wspy-accent-monitoring-rgb);
  --bs-link-color: var(--wspy-accent-monitoring);
  --bs-link-hover-color: #1a7ec8;
}

/* ── Light theme refinements ──────────────────────────────── */
[data-bs-theme="light"] {
  --bs-body-bg: #f1f3f6;
}

/* ── Dark theme refinements ───────────────────────────────── */
[data-bs-theme="dark"] {
  --bs-body-bg: #1a1a2e;
  --bs-tertiary-bg: #16213e;
  --bs-card-bg: #16213e;
}

[data-bs-theme="dark"] .card {
  background-color: #16213e;
}

/* ── Font override ────────────────────────────────────────── */
:root {
  --bs-font-sans-serif: "DM Sans", "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Skeleton loaders ─────────────────────────────────────── */
@keyframes wspy-skeleton {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.wspy-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200px 100%;
  animation: wspy-skeleton 1.5s ease-in-out infinite;
  border-radius: 4px;
}

[data-bs-theme="light"] .wspy-skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.04) 75%);
  background-size: 200px 100%;
}

/* ── Station logo ─────────────────────────────────────────── */
.station-logo {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.station-logo-sm {
  width: 24px;
  height: 24px;
}

.station-logo-md {
  width: 36px;
  height: 36px;
}

.station-logo-lg {
  width: 48px;
  height: 48px;
}

.navbar-station-logo {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 2px solid var(--bs-border-color);
}

/* ── Utility classes ──────────────────────────────────────── */
.text-accent {
  color: var(--bs-primary) !important;
}

.bg-accent-subtle {
  background-color: rgba(var(--bs-primary-rgb), 0.1) !important;
}

.border-accent {
  border-color: var(--bs-primary) !important;
}

/* ── DataTables BS5 dark overrides ────────────────────────── */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
  background-color: var(--bs-tertiary-bg);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

/* ── Page header ──────────────────────────────────────────── */
.wspy-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.wspy-page-header h4 {
  margin: 0;
  font-weight: 600;
}

/* ── Card subtle border for dark ──────────────────────────── */
[data-bs-theme="dark"] .card {
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Scrollbar styling ────────────────────────────────────── */
[data-bs-theme="dark"] ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
  background: transparent;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Navbar theme toggle spacing ──────────────────────────── */
#layout-navbar #nav-theme-toggle {
  margin-right: 0.75rem;
}

/* ── Transitions ──────────────────────────────────────────── */
/* No transition:all — évite d'animer bg/color lors du theme switch */
.card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.nav-link {
  transition: opacity 0.15s ease;
}
/* Bloquer toute transition bg/color sur html/body (Vuexy layout-menu) */
html, body {
  transition: background-color 0s, color 0s !important;
}
/* Bloquer toutes les transitions pendant le switch de thème */
html.theme-switching,
html.theme-switching * {
  transition-duration: 0s !important;
}
/* Préserver l'animation lune/soleil (spécificité 0,2,1 > 0,1,1) */
html.theme-switching .theme-switch *,
html.theme-switching .theme-switch *::before,
html.theme-switching .theme-switch *::after {
  transition: var(--transition) !important;
}
html.theme-switching .theme-switch__circle-container {
  transition: var(--circle-transition) !important;
}

/* ── Badge zone indicator ─────────────────────────────────── */
.zone-badge {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15em 0.5em;
  border-radius: 0.25rem;
}

.zone-badge-monitoring {
  background-color: rgba(var(--wspy-accent-monitoring-rgb), 0.15);
  color: var(--wspy-accent-monitoring);
}

.zone-badge-desk {
  background-color: rgba(var(--wspy-accent-desk-rgb), 0.15);
  color: var(--wspy-accent-desk);
}

/* ── Navbar station switcher (INT admin) ──────────────── */
.navbar-station-switcher {
  position: relative;
}

.navbar-station-switcher .current-station-menu {
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  transition: background 0.2s;
  user-select: none;
}

.navbar-station-switcher .current-station-menu:hover,
.navbar-station-switcher .current-station-menu:focus-visible {
  background: rgba(var(--bs-primary-rgb), 0.08);
  outline: none;
}

.navbar-station-switcher .station-chevron {
  font-size: 0.8rem;
  opacity: 0.6;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.navbar-station-switcher.open .station-chevron {
  transform: rotate(180deg);
}

.navbar-station-switcher .station-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 280px;
  max-width: min(360px, calc(100vw - 2rem));
  max-height: 320px;
  overflow: hidden;
  background: var(--bs-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 1060;
}

.navbar-station-switcher.open .station-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--bs-body-bg);
}

.navbar-station-switcher .station-search-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--bs-border-color);
  position: sticky;
  top: 0;
  background: var(--bs-body-bg);
  z-index: 1;
}

.navbar-station-switcher .station-search-menu i {
  font-size: 0.85rem;
  opacity: 0.5;
}

.navbar-station-switcher .station-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--bs-body-color);
  font-size: 0.875rem;
  padding: 0.25rem 0;
}

.navbar-station-switcher .station-search-input::placeholder {
  color: var(--bs-secondary-color);
}

.navbar-station-switcher .station-option-menu {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--bs-body-color);
  font-size: 0.875rem;
  transition: background 0.15s;
}

.navbar-station-switcher .station-option-menu:hover {
  background: rgba(var(--bs-primary-rgb), 0.08);
  color: var(--bs-body-color);
}

.navbar-station-switcher .station-option-menu.active {
  background: rgba(var(--bs-primary-rgb), 0.15);
  color: var(--bs-primary);
  font-weight: 600;
}

@media (max-width: 575px) {
  .navbar-station-switcher .station-dropdown-menu {
    min-width: min(320px, calc(100vw - 1rem));
  }
}

/* Menu brand logo — dark/light variants */
#layout-menu .app-brand {
  justify-content: center;
  align-items: center;
  position: relative;
  padding-top: 0.625rem;
  padding-bottom: 0.375rem;
}

#layout-menu .app-brand .layout-menu-toggle {
  position: absolute;
  right: 0.75rem;
}

/* Full logo (expanded) */
.menu-brand-logo-full {
  width: 140px;
  height: auto;
}

/* Small logo (collapsed) — hidden by default */
.menu-brand-logo-sm {
  width: 32px;
  height: auto;
  display: none !important;
}

/* Dark/light toggle */
.menu-brand-logo-dark { display: block; }
.menu-brand-logo-light { display: none; }

[data-bs-theme="light"] .menu-brand-logo-dark { display: none; }
[data-bs-theme="light"] .menu-brand-logo-light { display: block; }

/* Collapsed: swap full → small logo */
.layout-menu-collapsed:not(.layout-menu-hover) .menu-brand-logo-full { display: none !important; }
.layout-menu-collapsed:not(.layout-menu-hover) .menu-brand-logo-sm.menu-brand-logo-dark { display: block !important; }
[data-bs-theme="light"] .layout-menu-collapsed:not(.layout-menu-hover) .menu-brand-logo-sm.menu-brand-logo-dark { display: none !important; }
[data-bs-theme="light"] .layout-menu-collapsed:not(.layout-menu-hover) .menu-brand-logo-sm.menu-brand-logo-light { display: block !important; }

/* Zone switch — bottom of sidebar */
@keyframes iconBounceLeft {
  0%,100% { transform: translateX(0); }
  40%      { transform: translateX(-5px); }
  70%      { transform: translateX(-2px); }
}
.zone-switch {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  padding: 12px;
}
.zone-switch-btn {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 10px; border-radius: 8px !important;
  font-size: .85rem; font-weight: 700; letter-spacing: .02em;
}
.zone-switch-icon { transition: transform .15s; flex-shrink: 0; }
.zone-switch-btn:hover .zone-switch-icon { animation: iconBounceLeft .55s ease; }

/* ── Topbar station name overflow (MONITORING) ──────────────── */
.zone-monitoring #navbar-collapse h6 {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 1200px) {
  .zone-monitoring #navbar-collapse h6 {
    max-width: 300px;
  }
}

/* ── DESK topbar buttons ──────────────────────────────── */
.btn-topbar {
  border-radius: 6px !important;
  padding: 8px 18px;
  font-size: 0.9rem;
}
.btn-topbar.btn-liquid::after { border-radius: 6px !important; }

/* ── DataTables — Vuexy BS5 handles all styling ──────── */
/* Only custom: pageJump input + controls harmonisation   */

/* DT controls — harmonisation Vuexy (BS5 variables = auto dark/light) */
.dt-container .dt-page-jump-input,
.dt-container .dt-length select {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: .375rem .75rem;
  font-size: .9375rem;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  transition: border-color .15s ease-in-out;
}
.dt-container .dt-page-jump-input:focus,
.dt-container .dt-length select:focus {
  border-color: var(--bs-primary);
  outline: 0;
  box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

.dt-page-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .9375rem;
  white-space: nowrap;
}
.dt-page-jump-input {
  width: 4ch;
  text-align: center;
  -moz-appearance: textfield;
}
.dt-page-jump-input::-webkit-outer-spin-button,
.dt-page-jump-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── DESK Modals glass backdrop ───────────────────────── */
.zone-desk .modal-content.glass {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
[data-bs-theme="dark"] .zone-desk .modal-content.glass {
  background: rgba(22, 33, 62, 0.95) !important;
  --bs-modal-bg: rgba(22, 33, 62, 0.95);
}
[data-bs-theme="light"] .zone-desk .modal-content.glass {
  background: rgba(255, 255, 255, 0.92) !important;
  --bs-modal-bg: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.zone-desk .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.zone-desk .modal-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

/* ── Utility: thin progress bar ────────────────────────── */
.progress-thin { height: 3px; }
