/* AI Insight Styles */
.ai-insight-container {
  margin-bottom: 1.5rem;
  padding: 1.2rem;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(5, 11, 26, 0.8), rgba(30, 41, 59, 0.4));
  border: 1px solid rgba(94, 232, 255, 0.2);
}

.ai-insight-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.ai-badge {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #0f172a;
  background: #5ee8ff;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.ai-timestamp {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ai-narasi {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #e2e8f0;
  margin: 0 0 1rem;
}

.ai-poin-list {
  padding-left: 1.2rem;
  margin: 0;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.ai-poin-list li {
  margin-bottom: 0.4rem;
}

/* Mobile Only Visibility for AI Insight (as requested) */
@media (min-width: 768px) {
  .ai-insight-container {
    display: none !important;
  }
}

/* History Charts Scroll Snap */
@media (max-width: 768px) {
  .history-visual__charts {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
    gap: 1rem;
  }

  .history-visual__chart-card {
    min-width: 280px;
    scroll-snap-align: center;
  }
}

/* --- WEATHER MAP & CARDS --- */
.weather-section {
  margin-top: 2rem;
  border-radius: 28px;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: rgba(5, 11, 26, 0.6);
  border: 1px solid var(--card-border);
}

.section-title {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  font-weight: 700;
}

/* --- MAP WRAPPER --- */
#map-wrapper {
  position: relative;
  height: 400px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 4px solid rgba(255, 255, 255, 0.05);
  background: #0f172a;
  /* Dark fallback */
  margin-bottom: 2rem;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* --- MARKER SYSTEM (From Reference) --- */
.marker-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.marker-icon {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.4));
  will-change: transform;
}

.marker-label {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  margin-top: -10px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 10;
}

.marker-glow {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.8) 0%, rgba(245, 158, 11, 0) 70%);
  opacity: 0.6;
  animation: glow-pulse 3s infinite ease-in-out;
  z-index: -1;
}

/* --- ANIMATIONS --- */
@keyframes glow-pulse {

  0%,
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.4;
  }

  50% {
    transform: translateX(-50%) scale(1.4);
    opacity: 0.8;
  }
}

@keyframes drift-slow {
  0% {
    transform: translate3d(-5px, 0, 0);
  }

  50% {
    transform: translate3d(5px, -2px, 0);
  }

  100% {
    transform: translate3d(-5px, 0, 0);
  }
}

@keyframes drift-fast {
  0% {
    transform: translate3d(8px, 0, 0);
  }

  50% {
    transform: translate3d(-8px, 1px, 0);
  }

  100% {
    transform: translate3d(8px, 0, 0);
  }
}

@keyframes spin-rays {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes rain-drop {
  0% {
    transform: translateY(-10px);
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    transform: translateY(10px);
    opacity: 0;
  }
}

@keyframes flash {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* SVG CLASSES */
.svg-cloud-back {
  fill: #94a3b8;
  animation: drift-slow 12s ease-in-out infinite;
}

.svg-cloud-front {
  fill: #e2e8f0;
  stroke: #fff;
  stroke-width: 1.5px;
  animation: drift-fast 9s ease-in-out infinite;
}

.svg-sun-core {
  fill: #fbbf24;
  filter: drop-shadow(0 0 5px #fbbf24);
}

.svg-sun-rays {
  stroke: #fbbf24;
  stroke-width: 2;
  animation: spin-rays 20s linear infinite;
  transform-origin: center;
}

.svg-rain {
  stroke: #0ea5e9;
  stroke-width: 2.5;
  stroke-linecap: round;
  animation: rain-drop 1s linear infinite;
}

/* --- WEATHER CARDS (Grid) --- */
.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.weather-card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  /* Dark gradient for contrast */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1rem;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.weather-card:active {
  transform: scale(0.98);
}

.wc-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.wc-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.wc-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
}

.wc-badge.hulu {
  background: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}

.wc-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wc-anim {
  width: 48px;
  height: 48px;
}

.wc-temp {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  text-align: right;
  line-height: 1;
}

.wc-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
  margin-top: 2px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  #map-wrapper {
    height: 320px;
  }

  .marker-icon {
    width: 56px;
    height: 56px;
  }

  .marker-label {
    font-size: 0.7rem;
  }

  /* Horizontal scroll for cards on mobile */
  .weather-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
  }

  .weather-card {
    min-width: 160px;
    scroll-snap-align: center;
  }
}

/* --- INSTALLATION POPUP (Bottom Sheet) --- */
/* --- INSTALLATION POPUP --- */
.install-popup {
  position: fixed;
  z-index: 9999;
  background: #ffffff;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Hidden State Default */
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* Mobile: Bottom Sheet */
@media (max-width: 767px) {
  .install-popup {
    bottom: -100%;
    /* Start off-screen */
    left: 0;
    width: 100%;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    visibility: visible;
    /* To allow transform transition */
    opacity: 1;
  }

  .install-popup.visible {
    bottom: 0;
  }
}

/* Desktop: Center Modal */
@media (min-width: 768px) {
  .install-popup {
    top: 50%;
    left: 50%;
    width: 400px;
    border-radius: 24px;
    transform: translate(-50%, -50%) scale(0.9);
  }

  .install-popup.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
  }
}

.install-popup-head {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.install-popup-body {
  font-size: 0.95rem;
  color: #475569;
  margin-bottom: 24px;
  line-height: 1.5;
}

.install-popup-btn {
  width: 100%;
  background: #0ea5e9;
  color: white;
  font-weight: 600;
  padding: 14px;
  border-radius: 12px;
  border: none;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s;
}

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

.install-popup-btn:hover {
  background: #0284c7;
}

.install-popup-close {
  margin-top: 16px;
  font-size: 0.85rem;
  color: #94a3b8;
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}