/* =============================================
 * HCMC Daily — Design System
 * 
 * Giao diện thời tiết premium:
 * - Gradient nền thay đổi theo thời tiết/thời gian
 * - Glassmorphism cards
 * - Dark mode tự động sau 18h
 * - Mobile-first responsive
 * - Font: Inter (Google Fonts)
 * ============================================= */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* =============================================
 * CSS VARIABLES (Biến thiết kế)
 * Thay đổi ở đây sẽ ảnh hưởng toàn bộ app
 * ============================================= */
:root {
  /* Màu chính */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;

  /* Màu nền gradient — thay đổi theo thời tiết */
  --bg-start: #74b9ff;
  --bg-mid: #a29bfe;
  --bg-end: #6c5ce7;

  /* Màu chữ */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --text-muted: rgba(255, 255, 255, 0.5);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  --glass-blur: blur(20px);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Transition */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Safe area cho iPhone */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --- Dark mode (sau 18h hoặc preference hệ thống) --- */
[data-theme="dark"] {
  --bg-start: #0f0c29;
  --bg-mid: #302b63;
  --bg-end: #24243e;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* --- Weather-specific gradients --- */
[data-weather="clear-day"] {
  --bg-start: #f093fb;
  --bg-mid: #f5576c;
  --bg-end: #fda085;
}
[data-weather="clear-night"] {
  --bg-start: #0f0c29;
  --bg-mid: #302b63;
  --bg-end: #24243e;
}
[data-weather="clouds"] {
  --bg-start: #667eea;
  --bg-mid: #764ba2;
  --bg-end: #6B73C9;
}
[data-weather="rain"], [data-weather="drizzle"] {
  --bg-start: #4b6cb7;
  --bg-mid: #182848;
  --bg-end: #2c3e50;
}
[data-weather="thunderstorm"] {
  --bg-start: #373B44;
  --bg-mid: #4286f4;
  --bg-end: #373B44;
}

/* =============================================
 * RESET & BASE
 * ============================================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-mid), var(--bg-end));
  background-attachment: fixed;
  line-height: 1.5;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: calc(80px + var(--safe-bottom));
  transition: background 1s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

/* =============================================
 * LAYOUT
 * ============================================= */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-md);
}

/* =============================================
 * HEADER
 * ============================================= */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-md);
}

.header__title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header__title-icon {
  font-size: 1.5rem;
}

/* City selector dropdown */
.city-selector {
  position: relative;
}

.city-selector__button {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.city-selector__button:hover {
  background: rgba(255, 255, 255, 0.25);
}

.city-selector__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: rgba(30, 30, 60, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  z-index: 100;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: var(--transition);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.city-selector__dropdown.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.city-selector__option {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
}

.city-selector__option:hover,
.city-selector__option.active {
  background: rgba(255, 255, 255, 0.15);
}

.city-selector__option.active {
  font-weight: 600;
}

/* =============================================
 * CURRENT WEATHER CARD (Thời tiết hiện tại)
 * ============================================= */
.current-weather {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  margin-bottom: var(--space-lg);
}

.current-weather__icon {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: var(--space-sm);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.current-weather__temp {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -4px;
  margin-bottom: var(--space-xs);
}

.current-weather__temp sup {
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0;
  vertical-align: super;
}

.current-weather__desc {
  font-size: 1.25rem;
  font-weight: 500;
  text-transform: capitalize;
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

.current-weather__details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.detail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.detail-item__icon {
  font-size: 1.25rem;
}

.detail-item__value {
  font-size: 1rem;
  font-weight: 600;
}

.detail-item__label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Rain probability highlight */
.rain-alert {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  animation: pulse-soft 2s ease-in-out infinite;
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* =============================================
 * GLASS CARD (Thẻ hiệu ứng kính mờ)
 * ============================================= */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

.glass-card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}

.glass-card__title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* =============================================
 * HOURLY FORECAST (Dự báo theo giờ)
 * ============================================= */
.hourly-scroll {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-sm);
  margin: 0 calc(var(--space-lg) * -1);
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* Ẩn scrollbar nhưng vẫn cuộn được */
.hourly-scroll::-webkit-scrollbar {
  display: none;
}
.hourly-scroll {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hourly-item {
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  min-width: 65px;
  padding: var(--space-md) var(--space-sm);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.hourly-item:first-child {
  background: rgba(255, 255, 255, 0.12);
}

.hourly-item__time {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.hourly-item__icon {
  font-size: 1.75rem;
  line-height: 1;
}

.hourly-item__temp {
  font-size: 1rem;
  font-weight: 700;
}

.hourly-item__rain {
  font-size: 0.7rem;
  color: #74b9ff;
  font-weight: 500;
}

/* =============================================
 * DAILY FORECAST (Dự báo theo ngày)
 * ============================================= */
.daily-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.daily-item {
  display: grid;
  grid-template-columns: 80px 32px 1fr 50px;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.daily-item:last-child {
  border-bottom: none;
}

.daily-item__day {
  font-size: 0.9rem;
  font-weight: 500;
}

.daily-item__icon {
  font-size: 1.5rem;
  text-align: center;
}

.daily-item__temp-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  height: 6px;
}

.daily-item__temp-range {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  position: relative;
  overflow: hidden;
}

.daily-item__temp-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #74b9ff, #fda085);
  transition: var(--transition);
}

.daily-item__temps {
  font-size: 0.85rem;
  text-align: right;
  white-space: nowrap;
}

.daily-item__temps .temp-min {
  color: var(--text-muted);
}

.daily-item__rain {
  font-size: 0.75rem;
  color: #74b9ff;
  text-align: center;
}

/* =============================================
 * BOTTOM NAV (Thanh điều hướng dưới cùng)
 * ============================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 35, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  gap: 0;
  padding-bottom: var(--safe-bottom);
  z-index: 1000;
}

.bottom-nav__item {
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  min-height: 56px;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.bottom-nav__item.active {
  color: var(--primary-light);
}

.bottom-nav__item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary-light);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.bottom-nav__icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav__label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* =============================================
 * SETTINGS PAGE (Trang cài đặt)
 * ============================================= */

/* Settings uses a different background */
body.settings-page {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
}

.settings-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-lg);
}

.settings-header__back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: 1.25rem;
  transition: var(--transition);
}

.settings-header__back:hover {
  background: rgba(255, 255, 255, 0.25);
}

.settings-header__title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Setting group */
.setting-group {
  margin-bottom: var(--space-lg);
}

.setting-group__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  padding-left: var(--space-sm);
}

/* Setting item */
.setting-item {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-sm);
  transition: var(--transition);
}

.setting-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.setting-item__title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.setting-item__status {
  font-size: 0.8rem;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-weight: 500;
}

.setting-item__status.configured {
  background: rgba(46, 213, 115, 0.2);
  color: #2ed573;
}

.setting-item__status.not-configured {
  background: rgba(255, 71, 87, 0.2);
  color: #ff4757;
}

.setting-item__status.checking {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

.setting-item__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

/* Input field */
.input-group {
  display: flex;
  gap: var(--space-sm);
}

.input-field {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  min-height: 40px;
}

.btn-verify {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--glass-border);
}

.btn-verify:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 1rem;
  margin-top: var(--space-md);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Verify result message */
.verify-result {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: none;
  animation: slideIn 0.3s ease;
}

.verify-result.show {
  display: block;
}

.verify-result.success {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
}

.verify-result.error {
  background: rgba(255, 71, 87, 0.15);
  color: #ff6b81;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================
 * TOAST NOTIFICATION (Thông báo nhỏ)
 * ============================================= */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: calc(100% - var(--space-xl));
  max-width: 420px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  font-size: 0.9rem;
  color: var(--text-primary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

.toast.success { border-left: 3px solid #2ed573; }
.toast.error { border-left: 3px solid #ff4757; }
.toast.warning { border-left: 3px solid #ffc107; }
.toast.info { border-left: 3px solid #74b9ff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

/* =============================================
 * LOADING & EMPTY STATES
 * ============================================= */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  gap: var(--space-md);
}

.loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading__text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
}

.empty-state__icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.empty-state__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

.empty-state__link {
  color: var(--primary-light);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =============================================
 * STALE DATA BANNER (Dữ liệu cũ)
 * ============================================= */
.stale-banner {
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  font-size: 0.8rem;
  color: #ffc107;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* =============================================
 * RESPONSIVE (Màn hình lớn)
 * ============================================= */
@media (min-width: 768px) {
  .container {
    max-width: 560px;
  }

  .current-weather__temp {
    font-size: 6rem;
  }

  .hourly-item {
    min-width: 75px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 640px;
  }
}

/* =============================================
 * ACCESSIBILITY (Truy cập dễ dàng)
 * ============================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles cho keyboard navigation */
:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* =============================================
 * UTILITY CLASSES
 * ============================================= */
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.hidden { display: none !important; }

/* =============================================
 * 🌟 PREMIUM ENHANCEMENTS
 * ============================================= */

/* --- Animated Gradient Background --- */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    135deg,
    var(--bg-start) 0%,
    var(--bg-mid) 35%,
    var(--bg-end) 70%,
    var(--bg-start) 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  z-index: -2;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body {
  background: transparent !important;
}

/* --- Subtle Particle Dots --- */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, rgba(255,255,255,0.15), transparent),
    radial-gradient(2px 2px at 30% 70%, rgba(255,255,255,0.1), transparent),
    radial-gradient(2px 2px at 50% 40%, rgba(255,255,255,0.12), transparent),
    radial-gradient(2px 2px at 70% 80%, rgba(255,255,255,0.08), transparent),
    radial-gradient(2px 2px at 90% 30%, rgba(255,255,255,0.1), transparent),
    radial-gradient(1px 1px at 15% 55%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 45% 15%, rgba(255,255,255,0.12), transparent),
    radial-gradient(1px 1px at 75% 55%, rgba(255,255,255,0.1), transparent),
    radial-gradient(1px 1px at 85% 65%, rgba(255,255,255,0.08), transparent),
    radial-gradient(1px 1px at 25% 90%, rgba(255,255,255,0.12), transparent);
  animation: particleDrift 25s linear infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes particleDrift {
  0% { transform: translateY(0) translateX(0); }
  25% { transform: translateY(-3%) translateX(1%); }
  50% { transform: translateY(-1%) translateX(-1%); }
  75% { transform: translateY(-4%) translateX(2%); }
  100% { transform: translateY(0) translateX(0); }
}

/* --- Weather Icon Glow --- */
.current-weather__icon {
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
  animation: float 3s ease-in-out infinite, iconGlow 4s ease-in-out infinite alternate;
}

@keyframes iconGlow {
  from { filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2)); }
  to { filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.45)); }
}

/* --- Temperature Glow --- */
.current-weather__temp {
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.15);
}

/* --- Glass Card Shimmer Edge --- */
.glass-card {
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 200%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.03),
    transparent
  );
  animation: shimmer 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

/* --- Enhanced Loading Spinner --- */
.loading__spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-light);
  border-right-color: var(--primary);
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

/* --- Page Entrance Animation --- */
.container {
  animation: pageEnter 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* --- Staggered Card Animations --- */
.setting-group,
.glass-card,
.current-weather,
.route-card {
  animation: cardEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.setting-group:nth-child(1) { animation-delay: 0.05s; }
.setting-group:nth-child(2) { animation-delay: 0.1s; }
.setting-group:nth-child(3) { animation-delay: 0.15s; }
.glass-card:nth-child(1) { animation-delay: 0.1s; }
.glass-card:nth-child(2) { animation-delay: 0.15s; }
.glass-card:nth-child(3) { animation-delay: 0.2s; }

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Button Press Effect --- */
.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

/* --- Enhanced Input Focus --- */
.input-field:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), inset 0 0 0 1px rgba(99, 102, 241, 0.1);
  background: rgba(0, 0, 0, 0.35);
}

/* --- Bottom Nav Glow --- */
.bottom-nav__item.active .bottom-nav__icon {
  filter: drop-shadow(0 0 6px rgba(129, 140, 248, 0.6));
}

.bottom-nav__item.active::before {
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.5);
}

/* --- Status Badge Pulse --- */
.setting-item__status.configured {
  animation: statusPulse 3s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

/* --- Hourly Item Hover --- */
.hourly-item:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

/* --- Daily Item Hover --- */
.daily-item {
  transition: var(--transition);
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
  border-radius: var(--radius-sm);
}

.daily-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* --- Enhanced Temp Bar Gradient --- */
.daily-item__temp-fill {
  background: linear-gradient(90deg, #74b9ff, #a29bfe, #fd79a8, #fdcb6e);
  background-size: 200% 100%;
  animation: tempGradient 4s ease infinite;
}

@keyframes tempGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Toast with Icon --- */
.toast {
  border-left-width: 4px;
  font-weight: 500;
}

.toast.success::before { content: '✅ '; }
.toast.error::before { content: '❌ '; }
.toast.warning::before { content: '⚠️ '; }

/* --- Settings Page Accent Line --- */
body.settings-page::before {
  background: linear-gradient(
    135deg,
    #1a1a2e 0%,
    #16213e 35%,
    #0f3460 70%,
    #1a1a2e 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
}

/* --- Rain Alert Glow --- */
.rain-alert {
  box-shadow: 0 0 20px rgba(116, 185, 255, 0.15);
  border: 1px solid rgba(116, 185, 255, 0.2);
}

/* --- City Dropdown Animation --- */
.city-selector__dropdown.active {
  animation: dropdownIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* --- Scrollbar Styling (desktop) --- */
@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 6px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
  }
}

/* --- Selection Color --- */
::selection {
  background: rgba(99, 102, 241, 0.4);
  color: white;
}

/* =============================================
 * GPS BANNER
 * ============================================= */
.gps-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(46, 213, 115, 0.15);
  border: 1px solid rgba(46, 213, 115, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-size: 0.8rem;
  color: #2ed573;
  animation: fadeInDown 0.3s ease;
}
.gps-banner__icon { font-size: 1.1rem; }
.gps-banner__text { flex: 1; }
.gps-banner__refresh {
  background: none; border: none;
  font-size: 1rem; cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: transform 0.3s;
}
.gps-banner__refresh:active { transform: rotate(360deg); }

/* =============================================
 * SUN TRACKER
 * ============================================= */
.sun-tracker__times {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.sun-tracker__time {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.sun-tracker__icon { font-size: 1.5rem; }
.sun-tracker__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sun-tracker__value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.sun-tracker__bar {
  position: relative;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin: var(--space-sm) 0;
  overflow: visible;
}
.sun-tracker__progress {
  height: 100%;
  background: linear-gradient(90deg, #ff9f43, #ffd32a, #ff6b6b);
  border-radius: 3px;
  transition: width 1s ease;
}
.sun-tracker__dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  transition: left 1s ease;
  filter: drop-shadow(0 0 6px rgba(255,211,42,0.6));
}
.sun-tracker__daylight {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* =============================================
 * HEALTH CARDS (UV + AQI)
 * ============================================= */
.health-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.health-item {
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid rgba(255,255,255,0.08);
}
.health-item__header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-sm);
}
.health-item__icon { font-size: 1.1rem; }
.health-item__title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.health-item__value {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: var(--space-xs);
}
.health-item__bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-xs);
}
.health-item__bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s ease;
}
.health-item__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.health-item__advice {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* =============================================
 * TEMPERATURE CHART
 * ============================================= */
.chart-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-sm) 0;
}
.chart-container canvas {
  display: block;
  width: 100%;
  height: 200px;
}

/* =============================================
 * PULL TO REFRESH
 * ============================================= */
.ptr-indicator {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  z-index: 1000;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.ptr-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =============================================
 * INLINE BUTTON
 * ============================================= */
.btn-inline {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-inline:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

/* =============================================
 * DAILY ITEM RAIN
 * ============================================= */
.daily-item__rain {
  font-size: 0.7rem;
  color: #74b9ff;
  min-width: 40px;
  text-align: center;
}

/* =============================================
 * ANIMATIONS
 * ============================================= */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================
 * RAIN ALERT ENHANCED
 * ============================================= */
.rain-alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(116,185,255,0.12);
  border: 1px solid rgba(116,185,255,0.25);
  margin-top: var(--space-md);
  animation: fadeInDown 0.3s ease;
}
.rain-alert--active {
  background: rgba(255,71,87,0.15);
  border-color: rgba(255,71,87,0.35);
  animation: rain-pulse 2s ease-in-out infinite;
}
@keyframes rain-pulse {
  0%, 100% { border-color: rgba(255,71,87,0.35); }
  50% { border-color: rgba(255,71,87,0.6); box-shadow: 0 0 15px rgba(255,71,87,0.15); }
}
.rain-alert__main { font-weight: 600; font-size: 0.9rem; }
.rain-alert__sources { margin-top: 6px; color: var(--text-muted); font-size: 0.75rem; }
.rain-alert__upcoming { margin-top: 4px; color: #74b9ff; font-size: 0.75rem; }

/* =============================================
 * RADAR CARD
 * ============================================= */
.radar-container {
  position: relative;
  width: 100%;
  height: 200px;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-sm) 0;
}
.radar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
}
.radar-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.radar-crosshair {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  position: relative;
}
.radar-crosshair::before, .radar-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.4);
}
.radar-crosshair::before {
  width: 1px; height: 30px;
  left: 50%; top: -5px;
  transform: translateX(-50%);
}
.radar-crosshair::after {
  height: 1px; width: 30px;
  top: 50%; left: -5px;
  transform: translateY(-50%);
}
.radar-info {
  position: absolute;
  bottom: 8px; right: 8px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.5);
  padding: 3px 8px;
  border-radius: 4px;
}
.radar-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.radar-legend__item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.radar-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Live Badge */
.badge--live {
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255,71,87,0.2);
  color: #ff4757;
  font-weight: 700;
  letter-spacing: 1px;
  animation: live-blink 1.5s ease-in-out infinite;
  vertical-align: middle;
  margin-left: 6px;
}
@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Stale Banner */
.stale-banner {
  padding: 8px 14px;
  background: rgba(255,159,67,0.12);
  border: 1px solid rgba(255,159,67,0.25);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #ff9f43;
  margin-bottom: var(--space-md);
}
