/* app.awds.css — AWDS Weather widget styles */

/* ── Control button ────────────────────────────── */
.awds-weather-ctrl button.active {
  background-color: #3388ff !important;
  color: #fff !important;
}

/* ── Floating widget ───────────────────────────── */
.awds-widget {
  position: absolute;
  z-index: 800;
  width: auto;
  background: rgba(28, 28, 30, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  color: #e5e5e5;
  font: 12px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  overflow: hidden;
  display: none;
}

.awds-widget.open {
  display: block;
}

/* ── Header (drag handle) ──────────────────────── */
.awds-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  cursor: grab;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.awds-widget-header:active {
  cursor: grabbing;
}

.awds-widget-header .title {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: #fff;
}

.awds-widget-header .close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
}

.awds-widget-header .close-btn:hover {
  color: #fff;
}

/* ── Freshness indicator ───────────────────────── */
.awds-freshness {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.awds-freshness .fdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6b7280;
}

.awds-freshness .fdot.live {
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.awds-freshness .fdot.forecast {
  background: #60a5fa;
  box-shadow: 0 0 6px rgba(96, 165, 250, 0.5);
}

.awds-freshness .fdot.live-forecast {
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.awds-freshness .fdot.stale {
  background: #f97316;
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.4);
}

/* ── Status bar ────────────────────────────────── */
.awds-status {
  padding: 4px 12px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.awds-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.awds-status .dot.offline {
  background: #f87171;
}

.awds-status .dot.loading {
  background: #facc15;
  animation: awds-pulse 1s ease-in-out infinite;
}

@keyframes awds-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Tabs: Atmospheric / Oceanographic ─────────── */
.awds-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.awds-tabs button {
  flex: 1;
  padding: 7px 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.awds-tabs button:hover {
  color: rgba(255, 255, 255, 0.7);
}

.awds-tabs button.active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

/* ── Data type selector ────────────────────────── */
.awds-dataset {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
}

.awds-dataset button {
  flex: 1;
  padding: 5px 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.awds-dataset button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.awds-dataset button.active {
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}

/* ── Layer selector ────────────────────────────── */
.awds-layer-select {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.awds-layer-select select {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e5e5e5;
  font-size: 11px;
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
}

.awds-layer-select select:focus {
  border-color: rgba(96, 165, 250, 0.4);
}

.awds-layer-select select option {
  background: #1c1c1e;
  color: #e5e5e5;
}

/* ── Animation buttons (Wind / Waves) ─────────── */
.awds-anim-bar {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.awds-anim-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.awds-anim-btn:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.awds-anim-btn.active {
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}

.awds-anim-btn.disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ── Timeline slider ───────────────────────────── */
.awds-timeline {
  padding: 6px 12px 10px;
  display: none;
}

.awds-timeline.visible {
  display: block;
}

.awds-timeline-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 4px;
}

.awds-timeline-label .current {
  color: #93c5fd;
  font-weight: 600;
}

.awds-timeline input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
}

.awds-timeline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #60a5fa;
  border: 2px solid rgba(28, 28, 30, 0.9);
  cursor: pointer;
}

.awds-timeline input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #60a5fa;
  border: 2px solid rgba(28, 28, 30, 0.9);
  cursor: pointer;
}

/* ── Options row (Local Time) ────────────────── */
.awds-options-row {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Timezone toggle ──────────────────────────── */
.awds-tz-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  user-select: none;
}

.awds-tz-toggle:hover {
  color: rgba(255, 255, 255, 0.65);
}

.awds-tz-toggle input[type="checkbox"] {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #60a5fa;
  cursor: pointer;
}

/* ── Layer info ────────────────────────────────── */
.awds-layer-info {
  padding: 6px 12px 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.awds-layer-info span {
  color: rgba(255, 255, 255, 0.55);
}

/* ── Widget body (flex for altitude panel) ──────── */
.awds-widget-body {
  display: flex;
}

.awds-widget-main {
  width: 340px;
  flex-shrink: 0;
  overflow: hidden;
}

/* ── Altitude panel ───────────────────────────── */
.awds-altitude-panel {
  display: none;
  width: 150px;
  flex-shrink: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 6px;
  flex-direction: column;
  align-items: center;
}

.awds-altitude-panel.visible {
  display: flex;
}

.awds-alt-title {
  font-size: 10px;
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.awds-alt-body {
  flex: 1;
  display: flex;
  gap: 4px;
  width: 100%;
  min-height: 180px;
}

.awds-alt-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: none;
  appearance: none;
  width: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

.awds-alt-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #60a5fa;
  border: 2px solid rgba(28, 28, 30, 0.9);
  cursor: pointer;
}

.awds-alt-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #60a5fa;
  border: 2px solid rgba(28, 28, 30, 0.9);
  cursor: pointer;
}

.awds-alt-labels {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  min-height: 0;
}

.awds-alt-label {
  white-space: nowrap;
  line-height: 1.2;
  cursor: pointer;
  padding: 1px 0;
  transition: color 0.15s;
}

.awds-alt-label:hover {
  color: rgba(255, 255, 255, 0.8);
}

.awds-alt-label.active {
  color: #93c5fd;
  font-weight: 600;
}

.awds-alt-value {
  font-size: 10px;
  color: #93c5fd;
  font-weight: 600;
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}

/* ── Freshness altitude badge ─────────────────── */
.awds-fresh-alt {
  font-size: 9px;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: auto;
}

/* ── AWDS Popup (weather marker hover) ─────────── */
.awds-popup .maplibregl-popup-content {
  background: rgba(28, 28, 30, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  color: #e5e5e5;
  font-size: 11px;
}

.awds-popup .maplibregl-popup-tip {
  border-top-color: rgba(28, 28, 30, 0.94);
}

/* ── Parser badge ─────────────────────────────── */
.awds-parser-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.awds-parser-badge.metoc {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.awds-parser-badge.basic {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ── Heatmap section ──────────────────────────── */
.awds-heatmap-sec {
  padding: 6px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: none;
}

.awds-heatmap-sec.visible {
  display: block;
}

.awds-heatmap-title {
  font-size: 10px;
  font-weight: 600;
  color: #93c5fd;
  margin-bottom: 4px;
}

.awds-hm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  font-size: 11px;
}

.awds-hm-row input[type="radio"] {
  margin: 0;
  flex-shrink: 0;
  accent-color: #60a5fa;
}

.awds-hm-icon {
  width: 16px;
  text-align: center;
  color: #93c5fd;
  font-size: 11px;
  flex-shrink: 0;
}

.awds-hm-label {
  white-space: nowrap;
  color: #e5e5e5;
  flex-shrink: 0;
  min-width: 60px;
}

.awds-hm-unit {
  font-size: 9px;
  color: #999;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 2px;
}

.awds-hm-grad-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.awds-hm-gradient {
  flex: 1;
  height: 8px;
  border-radius: 2px;
  min-width: 40px;
}

.awds-hm-val {
  font-size: 9px;
  font-family: monospace;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  flex-shrink: 0;
}
