/* ==========================================================================
   WorldWave Radio - Real HD Flag Image Theme System
   ========================================================================== */

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

/* ==========================================================================
   DIRECT ABSOLUTE OVERRIDES FOR LIGHT THEME (DAY MODE ☀️)
   ========================================================================== */
html.light, html.light body, body.light, html[data-theme="light"], body[data-theme="light"] {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html.light .navbar, body.light .navbar, html[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html.light .country-pills-bar, body.light .country-pills-bar, html[data-theme="light"] .country-pills-bar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html.light .country-pill, body.light .country-pill, html[data-theme="light"] .country-pill {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}

html.light .country-pill:hover, body.light .country-pill:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html.light .country-pill.active, body.light .country-pill.active {
  background: #d1fae5 !important;
  color: #059669 !important;
  border-color: #059669 !important;
}

html.light .station-card, body.light .station-card, html[data-theme="light"] .station-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

html.light .station-card:hover, body.light .station-card:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08) !important;
}

html.light .player-deck, body.light .player-deck, html[data-theme="light"] .player-deck {
  background: rgba(255, 255, 255, 0.95) !important;
  border-top: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}

html.light #searchInput, html.light #countrySelect, html.light #sortSelect,
body.light #searchInput, body.light #countrySelect, body.light #sortSelect {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

html.light #countrySelect option, body.light #countrySelect option {
  background: #ffffff !important;
  color: #0f172a !important;
}

html.light .card-title, html.light .section-title h2, html.light #playerStationName, html.light .brand-text h1,
body.light .card-title, body.light .section-title h2, body.light #playerStationName, body.light .brand-text h1 {
  color: #0f172a !important;
}

html.light .tag-genre, body.light .tag-genre {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

html.light .title-flag-badge, body.light .title-flag-badge {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
}

/* ==========================================================================
   DIRECT ABSOLUTE OVERRIDES FOR DARK THEME (NIGHT MODE 🌙)
   ========================================================================== */
html.dark, html.dark body, body.dark, html[data-theme="dark"], body[data-theme="dark"] {
  background-color: #0b0f19 !important;
  color: #f8fafc !important;
}

html.dark .navbar, body.dark .navbar, html[data-theme="dark"] .navbar {
  background: rgba(11, 15, 25, 0.95) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

html.dark .country-pills-bar, body.dark .country-pills-bar, html[data-theme="dark"] .country-pills-bar {
  background: #111827 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

html.dark .country-pill, body.dark .country-pill, html[data-theme="dark"] .country-pill {
  background: #1e293b !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #cbd5e1 !important;
}

html.dark .country-pill:hover, body.dark .country-pill:hover {
  background: #334155 !important;
  color: #ffffff !important;
}

html.dark .country-pill.active, body.dark .country-pill.active {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #10b981 !important;
  border-color: #10b981 !important;
}

html.dark .station-card, body.dark .station-card, html[data-theme="dark"] .station-card {
  background: #121a2a !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

html.dark .station-card:hover, body.dark .station-card:hover {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
}

html.dark .player-deck, body.dark .player-deck, html[data-theme="dark"] .player-deck {
  background: rgba(11, 15, 25, 0.96) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
}

html.dark #searchInput, html.dark #countrySelect, html.dark #sortSelect,
body.dark #searchInput, body.dark #countrySelect, body.dark #sortSelect {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

html.dark #countrySelect option, body.dark #countrySelect option {
  background: #1e293b !important;
  color: #f8fafc !important;
}

html.dark .card-title, html.dark .section-title h2, html.dark #playerStationName, html.dark .brand-text h1,
body.dark .card-title, body.dark .section-title h2, body.dark #playerStationName, body.dark .brand-text h1 {
  color: #f8fafc !important;
}

html.dark .tag-genre, body.dark .tag-genre {
  background: #1e293b !important;
  color: #94a3b8 !important;
}

html.dark .title-flag-badge, body.dark .title-flag-badge {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

/* Base structural layout */
body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 95px;
}

/* Real Flag Image Classes */
.nav-flag-img {
  width: 22px;
  height: 15px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  vertical-align: middle;
}

.pill-flag-img {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  object-fit: cover;
  margin-right: 6px;
  vertical-align: middle;
}

.title-flag-img {
  width: 28px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  vertical-align: middle;
}

.card-flag-img {
  width: 16px;
  height: 11px;
  border-radius: 2px;
  object-fit: cover;
  margin-right: 4px;
  vertical-align: middle;
}

.player-flag-img {
  width: 16px;
  height: 11px;
  border-radius: 2px;
  object-fit: cover;
  margin-right: 4px;
  vertical-align: middle;
}

.title-flag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 8px;
  margin-right: 10px;
  vertical-align: middle;
  transition: all 0.2s ease;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 28px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.accent-text {
  background: linear-gradient(90deg, #4f46e5, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Search Bar */
.search-container {
  flex: 1;
  max-width: 440px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: #64748b;
  font-size: 13px;
}

#searchInput {
  width: 100%;
  padding: 10px 40px 10px 42px;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s ease;
}

#searchInput:focus {
  border-color: #4f46e5 !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.clear-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 13px;
}

.clear-btn:hover { color: #0f172a; }

/* Header Actions & Country Selector */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.country-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 9999px;
}

.globe-icon {
  color: #4f46e5;
  font-size: 14px;
}

#countrySelect {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.3);
  border-radius: 9999px;
  color: #ec4899;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover, .nav-btn.active {
  background: #ec4899;
  color: #fff;
}

.badge {
  background: #ec4899;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.nav-btn:hover .badge {
  background: #fff;
  color: #ec4899;
}

/* Theme Toggle Button */
.theme-btn {
  background: rgba(79, 70, 229, 0.12) !important;
  border: 1px solid rgba(79, 70, 229, 0.3) !important;
  color: #4f46e5 !important;
}

.theme-btn:hover {
  background: #4f46e5 !important;
  color: #ffffff !important;
}

/* Country Pills Bar */
.country-pills-bar {
  padding: 12px 28px;
  transition: all 0.3s ease;
}

.country-pills-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.country-pills-scroll::-webkit-scrollbar { display: none; }

.country-pill {
  padding: 6px 14px;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

/* Main Content & Section Header */
.main-content {
  flex: 1;
  padding: 24px 28px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

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

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

.section-title h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
}

.count-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: #059669;
  background: #d1fae5;
  border: 1px solid #059669;
  padding: 2px 10px;
  border-radius: 9999px;
}

.sort-options {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-size: 12.5px;
}

#sortSelect {
  padding: 5px 10px;
  border-radius: 8px;
  outline: none;
  font-size: 12.5px;
  cursor: pointer;
}

/* Stations Grid & Cards */
.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.station-card {
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.station-card.playing {
  border-color: #4f46e5 !important;
  box-shadow: 0 0 16px rgba(79, 70, 229, 0.3) !important;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.card-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-logo i {
  font-size: 18px;
  color: #4f46e5;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

.tag-country {
  background: rgba(79, 70, 229, 0.15);
  color: #4f46e5;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.bitrate-info {
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-fav-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
}

.card-fav-btn:hover, .card-fav-btn.active {
  color: #ec4899;
}

.play-card-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #4f46e5;
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.2);
}

.station-card:hover .play-card-btn {
  transform: scale(1.08);
}

/* Skeleton Loading Cards */
.skeleton-card {
  height: 110px;
  background: rgba(0,0,0,0.05);
  border-radius: 12px;
  animation: pulseSkeleton 1.5s infinite ease-in-out;
}

@keyframes pulseSkeleton {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #64748b;
}

.empty-icon {
  font-size: 44px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.primary-btn {
  margin-top: 16px;
  padding: 9px 20px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Bottom Audio Player Deck */
.player-deck {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 12px 28px;
  z-index: 1000;
  transition: all 0.3s ease;
}

.player-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr auto 220px;
  align-items: center;
  gap: 20px;
}

.now-playing-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.station-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4f46e5, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
}

.station-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.station-details {
  min-width: 0;
  flex: 1;
}

.station-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

#playerStationName {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-badge {
  font-size: 9px;
  font-weight: 800;
  background: #4f46e5;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

#playerStationMeta {
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-icon-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
}

.fav-icon-btn.active { color: #ec4899; }

/* Visualizer Canvas & Live Badge */
.visualizer-container {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

#visualizerCanvas {
  border-radius: 4px;
  background: rgba(0,0,0,0.05);
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: #059669;
  background: #d1fae5;
  border: 1px solid #059669;
  padding: 2px 8px;
  border-radius: 9999px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #059669;
}

/* Center Player Controls */
.player-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
}

.control-btn {
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

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

.control-btn.sm {
  width: 34px;
  height: 34px;
  font-size: 12px;
  background: rgba(0,0,0,0.06);
  color: inherit;
}

.control-btn.lg {
  width: 46px;
  height: 46px;
  font-size: 16px;
  background: #4f46e5;
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

/* Player Right Tools */
.player-extra {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 15px;
  cursor: pointer;
}

.volume-slider {
  width: 75px;
  accent-color: #4f46e5;
  cursor: pointer;
}

/* Sleep Timer Menu */
.timer-container {
  position: relative;
}

.timer-badge {
  position: absolute;
  top: -5px;
  right: -7px;
  background: #ec4899;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 6px;
}

.timer-menu {
  position: absolute;
  bottom: 40px;
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 130px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
  z-index: 1100;
}

.menu-header {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 600;
  padding: 2px 4px;
}

.timer-opt {
  background: #f1f5f9;
  border: none;
  color: #0f172a;
  padding: 6px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  text-align: left;
}

.timer-opt:hover {
  background: #4f46e5;
  color: #fff;
}

.timer-opt.cancel { color: #ec4899; }

.hidden { display: none !important; }

@media (max-width: 900px) {
  .player-inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px;
  }
  .visualizer-container { display: none; }
  .navbar { flex-wrap: wrap; }
  .search-container { order: 3; max-width: 100%; width: 100%; }
}
