/**
 * css/imd-radar.css
 * Met Centre Patna — Doppler Weather Radar (DWR) UI & Studio Styles
 * Premium Meteorological Theme with Glassmorphism, Micro-animations & Aurora Accents.
 */

/* ── Split Action / Dropdown Wrapper for Radar in Top Bar ── */
.radar-btn-group {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.radar-btn-group:hover {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.radar-btn-group.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(59, 130, 246, 0.25));
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.radar-btn-main {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 11px;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
}

.radar-btn-main i {
  color: #38bdf8;
  font-size: 12px;
  transition: transform 0.3s ease;
}

.radar-btn-group.active .radar-btn-main i {
  color: #00ffff;
  animation: radarDishPulse 2s infinite ease-in-out;
}

@keyframes radarDishPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px #00ffff); }
  50% { transform: scale(1.15) rotate(10deg); filter: drop-shadow(0 0 6px #38bdf8); }
}

.radar-btn-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
}

.radar-btn-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.radar-btn-chevron:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* ── Radar Hub Dropdown Menu ── */
#radarSourceMenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 330px;
  max-height: calc(100vh - 65px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.4) rgba(15, 23, 42, 0.6);
  background: rgba(11, 19, 43, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 16px rgba(56, 189, 248, 0.15);
  z-index: 1200;
  display: none;
  color: #e2e8f0;
  animation: radarDropFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#radarSourceMenu.open {
  display: block;
}

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

/* Dropdown Header */
.rsm-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rsm-hub-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.rsm-hub-title i {
  color: #38bdf8;
  font-size: 13px;
}

.rsm-hub-switch-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
}

/* Master Toggle switch */
.radar-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}

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

.radar-slider-round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.3s;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.radar-slider-round:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 50%;
}

.radar-switch input:checked + .radar-slider-round {
  background-color: #0284c7;
  border-color: #38bdf8;
}

.radar-switch input:checked + .radar-slider-round:before {
  transform: translateX(14px);
  background-color: #ffffff;
}

/* Provider Tabs (IMD DWR Patna vs Others) */
.rsm-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.rsm-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.rsm-tab-btn:hover {
  color: #e2e8f0;
}

.rsm-tab-btn.active {
  background: rgba(56, 189, 248, 0.22);
  color: #38bdf8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Products Grid */
.rsm-products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.imd-prod-pill {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.imd-prod-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
}

.imd-prod-pill.active {
  background: rgba(14, 165, 233, 0.22);
  border-color: #38bdf8;
}

.imd-prod-pill .p-name {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.imd-prod-pill.active .p-name {
  color: #38bdf8;
}

.imd-prod-pill .p-desc {
  font-size: 9px;
  color: #64748b;
  margin-top: 2px;
}

/* Control Row (Opacity & Range rings) */
.rsm-ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 11px;
  color: #94a3b8;
}

.rsm-opacity-slider {
  width: 90px;
  height: 4px;
  accent-color: #38bdf8;
  cursor: pointer;
}

.rsm-action-strip {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.rsm-studio-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(37, 99, 235, 0.3));
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.rsm-studio-btn:hover {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.5), rgba(37, 99, 235, 0.5));
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

/* ── Leaflet Range Rings Distance Labels ── */
.radar-ring-label {
  background: transparent;
  border: none;
}

.radar-ring-label span {
  display: inline-block;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 9px;
  font-weight: 700;
  color: #38bdf8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.radar-station-tooltip {
  background: rgba(15, 23, 42, 0.92) !important;
  border: 1px solid #ef4444 !important;
  color: #fff !important;
  font-size: 11px !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   RADAR STUDIO INSPECTOR MODAL
   ═══════════════════════════════════════════════════════════════════════ */

.imd-radar-studio-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.imd-radar-studio-modal.open {
  visibility: visible;
  opacity: 1;
}

.rsm-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rsm-window {
  position: relative;
  width: 92vw;
  max-width: 1200px;
  height: 88vh;
  background: rgba(13, 20, 39, 0.98);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rsmWindowPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rsmWindowPop {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Modal Header */
.rsm-header {
  height: 58px;
  padding: 0 20px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.rsm-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rsm-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #ef4444;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.rsm-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  animation: rsmBlink 1.4s infinite;
}

@keyframes rsmBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.rsm-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.rsm-subtitle {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
}

.rsm-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rsm-head-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rsm-head-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.rsm-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fff;
}

/* Modal Body */
.rsm-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.rsm-sidebar {
  width: 290px;
  background: rgba(10, 16, 32, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.rsm-side-section-title {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.rsm-prod-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rsm-prod-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.rsm-prod-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.3);
}

.rsm-prod-item.active {
  background: rgba(14, 165, 233, 0.18);
  border-color: #38bdf8;
  color: #fff;
}

.rsm-pi-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  font-size: 12px;
  flex-shrink: 0;
}

.rsm-prod-item.active .rsm-pi-icon {
  background: #0284c7;
  color: #fff;
}

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

.rsm-pi-title {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rsm-pi-desc {
  font-size: 9px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.rsm-pi-chk {
  color: #38bdf8;
  font-size: 11px;
  margin-left: 4px;
}

.rsm-side-info-card {
  margin-top: auto;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 10px;
  color: #94a3b8;
}

.rsm-info-row {
  margin-bottom: 4px;
}

.rsm-link-out {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
  margin-top: 6px;
}

.rsm-link-out:hover {
  text-decoration: underline;
}

/* Main Viewport */
.rsm-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #060b18;
  position: relative;
  overflow: hidden;
}

.rsm-view-toolbar {
  height: 42px;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rsm-active-label {
  font-size: 12px;
  color: #e2e8f0;
}

.rsm-type-tag {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  margin-left: 6px;
}

.rsm-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rsm-tool-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

.rsm-tool-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
}

/* Image Stage */
.rsm-img-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at center, #0f1c3f 0%, #060b18 80%);
}

#rsmMainImage {
  max-width: 94%;
  max-height: 94%;
  object-fit: contain;
  transition: transform 0.2s ease-out;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  user-select: none;
}

.rsm-spinner {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #38bdf8;
  font-size: 13px;
  font-weight: 600;
}

/* Legend Bar */
.rsm-legend-bar {
  background: rgba(10, 18, 36, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rsm-legend-title {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rsm-legend-gradient {
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(to right, #00ffff, #0080ff, #00ff00, #ffff00, #ff8000, #ff0000, #ff00ff, #ffffff);
}

.rsm-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #cbd5e1;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .rsm-window {
    width: 96vw;
    height: 94vh;
  }
  .rsm-sidebar {
    width: 220px;
  }
  #radarSourceMenu {
    width: 290px;
  }
}
