/* ========================================== */
/* 1. Global Variables & Defaults             */
/* ========================================== */
:root {
  /* Defined these variables so your border-radius works */
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ========================================== */
/* 2. Search Dropdown                         */
/* ========================================== */
.search-dropdown {
  font-family: 'Inter', sans-serif;
}

.search-results {
  margin-top: 0.25rem;
  max-height: 320px;
  overflow: auto;
}

.search-results .loading,
.search-results .no-results,
.search-results .error {
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  color: #e6f6ff;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  margin-bottom: 0.25rem;
}

.search-results .result-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: none;
  background: rgba(255, 255, 255, 0.02);
  color: #e6f6ff;
  cursor: pointer;
  font-size: 0.95rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
}

.search-results .result-item:hover,
.search-results .result-item:focus {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

/* ========================================== */
/* 3. BZ & General Links                      */
/* ========================================== */
.bz-learn-more {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  color: #38bdf8;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.bz-learn-more:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.bz-learn-more .magnet-icon {
  font-size: 1.2rem;
}

.bz-learn-more .learn-text {
  white-space: nowrap;
}

.bz-link,
.sw-link {
  color: #38bdf8;
  text-decoration: underline;
  text-decoration-color: rgba(56, 189, 248, 0.4);
  transition: all 0.2s ease;
}

.sw-link:hover,
.bz-link:hover {
  color: #7dd3fc;
  text-decoration-color: #7dd3fc;
}

/* ========================================== */
/* 4. Solar Wind & Card Actions               */
/* ========================================== */
#solarWindCard {
  position: relative;
}

.card-actions {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 60;
}

.sw-learn-more {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  color: #f59e0b;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 50;
}

.sw-learn-more:hover {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.18);
}

.sw-learn-more .sun-icon {
  font-size: 1.1rem;
}

.kp-learn-more {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.25);
  border-radius: 8px;
  color: #14b8a6;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 50;
}

.kp-learn-more:hover {
  background: rgba(20, 184, 166, 0.18);
  border-color: rgba(20, 184, 166, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.18);
}

.kp-learn-more .magnet-icon {
  font-size: 1.1rem;
}

/* Footer link specific overrides */
.footer-links {
  margin-top: 6px;
}

.footer-links a.sw-link {
  color: #f59e0b;
  text-decoration: underline;
  text-decoration-color: rgba(67, 51, 190, 0.28);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.footer-links a.sw-link:hover {
  color: #fb923c;
  text-decoration-color: #fb923c;
}

/* ========================================== */
/* 5. Info Footer                             */
/* ========================================== */
#info-footer {
  position: relative;
  margin: 20px auto 10px auto;
  width: 90%;
  max-width: 600px;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  z-index: 100;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
  transition: opacity 0.5s ease, transform 0.5s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  /* Fixed: variable must be defined in :root */
  border-radius: var(--radius-lg);
  border: 2px solid rgba(56, 189, 248, 0.4);
  overflow: hidden;
  min-height: 150px;
}

#info-footer.visible {
  opacity: 1;
  transform: scaleY(1);
}

.aurora-result-content {
  margin-bottom: 8px;
  line-height: 1.5;
  word-wrap: break-word;
  min-height: 56px;
}

.info-footer-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: nowrap;
  padding-bottom: 24px;
}

.info-footer-buttons .home-location-btn {
  flex: 1;
  min-width: 100px;
  max-width: 180px;
  padding: 8px 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

/* ========================================== */
/* 6. Cloud Toggle Button                     */
/* ========================================== */
#cloudToggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
  border: 2px solid rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  color: #e6f6ff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-family: 'Inter', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#cloudToggle:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.25);
  transform: translateY(-2px);
}

#cloudToggle:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
}

/* ENABLED/ACTIVE STATE - Clouds visible */
#cloudToggle[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(56, 189, 248, 0.15) 100%);
  border-color: rgba(34, 197, 94, 0.6);
  color: #22c55e;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.2);
}

#cloudToggle[aria-pressed="true"]:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.35) 0%, rgba(56, 189, 248, 0.2) 100%);
  border-color: rgba(34, 197, 94, 0.8);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
  transform: translateY(-3px);
}

/* DISABLED STATE */
#cloudToggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.05) 0%, rgba(34, 197, 94, 0.02) 100%);
  border-color: rgba(56, 189, 248, 0.2);
}

/* Cloud emoji animation when active */
#cloudToggle[aria-pressed="true"] .cloud-emoji {
  animation: cloud-pulse 2s ease-in-out infinite;
}

/* Indicator dot - shows toggle state */
.cloud-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.5);
  transition: all 0.3s ease;
  margin-left: 4px;
}

#cloudToggle[aria-pressed="true"] .cloud-indicator {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: indicator-glow 1.5s ease-in-out infinite;
}

/* ========================================== */
/* 7. Forecast Playback Controls              */
/* ========================================== */
#playbackToggleBtn {
  position: absolute;
  top: 72px;
  right: 20px;
  z-index: 210;
}

#playbackControls {
  z-index: 220;
  min-width: min(560px, 92vw);
}

#playbackSpeed {
  min-width: 76px;
  padding-left: 10px;
  padding-right: 10px;
}

/* ========================================== */
/* 8. Animations                              */
/* ========================================== */
@keyframes cloud-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.9;
  }
}

@keyframes indicator-glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  }
  50% {
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.9);
  }
}

/* ========================================== */
/* 9. Media Queries                           */
/* ========================================== */
@media (max-width: 768px) {
  .card-actions {
    position: static;
    display: inline-flex;
    margin-bottom: 12px;
    gap: 10px;
  }

  .bz-learn-more,
  .sw-learn-more,
  .kp-learn-more {
    display: inline-flex;
  }

  #info-footer {
    font-size: 14px;
    padding: 10px 14px;
    margin: 16px auto 8px auto;
    width: 95%;
    z-index: 100;
    /* Fixed: variable must be defined in :root */
    border-radius: var(--radius-lg);
  }

  #cloudToggle {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 9px 14px;
    font-size: 0.9rem;
    gap: 6px;
  }

  .cloud-emoji {
    font-size: 1.2rem;
  }

  #playbackToggleBtn {
    right: 20px;
    top: 72px;
    padding: 9px 14px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  #info-footer {
    font-size: 13px;
    padding: 10px 12px;
    margin: 12px auto 8px auto;
    width: 95%;
    z-index: 100;
    /* Fixed: variable must be defined in :root */
    border-radius: var(--radius-md);
  }

  .aurora-result-content {
    font-size: 0.9rem;
    min-height: 64px;
  }

  #cloudToggle {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 10px;
    font-size: 0.85rem;
    gap: 4px;
  }

  /* Hide label text on small screens so the button stays compact */
  #cloudToggle > span:not(.cloud-emoji):not(.cloud-indicator) {
    display: none;
  }

  .cloud-emoji {
    font-size: 1rem;
  }

  .cloud-indicator {
    width: 6px;
    height: 6px;
  }

  #playbackToggleBtn {
    right: 20px;
    top: 68px;
    padding: 8px 10px;
  }

}


/* Desktop only: hide cloud toggle text label while search is expanded */
@media (min-width: 769px) {
  .location-search-control:has(.search-container.expanded) ~ #cloudToggle > span:not(.cloud-emoji):not(.cloud-indicator) {
    display: none;
  }
}

/* Mobile: fade out cloud toggle and forecast button while search is open */
@media (max-width: 768px) {
  #cloudToggle,
  #playbackToggleBtn {
    transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .location-search-control:has(.search-container.expanded) ~ #cloudToggle,
  .location-search-control:has(.search-container.expanded) ~ #playbackToggleBtn,
  .location-search-control:has(.search-container.expanded) ~ #playbackControls {
    opacity: 0;
    pointer-events: none;
  }
}