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

body {
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px 40px;
  transition: background 0.4s;
}

/* =============================================
   THEMES � applied on <body>
   ============================================= */
body.light {
  background: linear-gradient(160deg, #6AAEDC 0%, #A8D5EE 100%);
  --bg-gradient: linear-gradient(170deg, #5FA8D8 0%, #8DC9E8 50%, #AADCF4 100%);
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-shadow: 0 8px 32px rgba(30, 80, 140, 0.18);
  --text-primary: #1a2744;
  --text-secondary: #4a6080;
  --text-muted: #7a95b0;
  --accent: #3B9BD4;
  --accent-btn: #3B9BD4;
  --divider: rgba(100, 160, 210, 0.2);
  --hourly-active-bg: rgba(255,255,255,0.5);
  --header-color: #1a2744;
  --rec-card-bg: rgba(255, 255, 255, 0.92);
  --rec-border: rgba(59, 155, 212, 0.25);
  --warning-color: #e65c00;
}

body.dark {
  background: linear-gradient(160deg, #0F1A3E 0%, #1A2B5F 100%);
  --bg-gradient: linear-gradient(170deg, #0F1A3E 0%, #172247 50%, #1E2E60 100%);
  --card-bg: rgba(30, 45, 100, 0.90);
  --card-shadow: 0 8px 32px rgba(5, 15, 50, 0.45);
  --text-primary: #E8F0FC;
  --text-secondary: #8BA4D4;
  --text-muted: #5A78B0;
  --accent: #FFD54F;
  --accent-btn: #3B9BD4;
  --divider: rgba(80, 110, 180, 0.3);
  --hourly-active-bg: rgba(255,255,255,0.08);
  --header-color: #E8F0FC;
  --rec-card-bg: rgba(25, 38, 88, 0.95);
  --rec-border: rgba(80, 130, 200, 0.3);
  --warning-color: #FFB74D;
}

/* =============================================
   PHONE CARD
   ============================================= */
.app-wrapper {
  width: 100%;
  max-width: 400px;
}

.phone-card {
  width: 100%;
  background: var(--bg-gradient);
  border-radius: 36px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  min-height: 700px;
  padding-bottom: 28px;
}

/* =============================================
   APP HEADER
   ============================================= */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px 0;
  color: var(--header-color);
}

.location-block {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pin-icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.location-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}

.hamburger-btn:hover { opacity: 0.7; }

.hamburger-btn svg {
  width: 22px;
  height: 16px;
  color: var(--text-primary);
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 28px 36px;
  text-align: center;
  gap: 16px;
}

.empty-bike {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 280px;
}

.primary-btn {
  background: var(--accent-btn);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59, 155, 212, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 155, 212, 0.5);
}

.empty-search {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

.empty-search input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid rgba(255,255,255,0.55);
  border-radius: 14px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: rgba(255,255,255,0.35);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}

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

.empty-search input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.55);
}

.empty-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.empty-separator::before,
.empty-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.geo-outline-btn {
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 50px;
  padding: 11px 26px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.geo-outline-btn:hover {
  background: rgba(255,255,255,0.35);
  border-color: var(--accent);
}

/* =============================================
   LOADING STATE
   ============================================= */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--divider);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  padding: 0 0 8px;
}

/* =============================================
   CURRENT WEATHER
   ============================================= */
.current-section {
  padding: 12px 24px 20px;
  color: var(--text-primary);
}

.current-date {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.current-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.current-left {
  display: flex;
  flex-direction: column;
}

.current-temp {
  font-size: 68px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: -3px;
}

.current-desc {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: capitalize;
}

.current-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.current-icon-wrapper {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.current-icon-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  display: block;
}

.current-minmax {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* =============================================
   POLLEN STRIP
   ============================================= */
.pollen-strip {
  margin: 0 14px 10px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(134, 197, 98, 0.12);
  border: 1px solid rgba(134, 197, 98, 0.28);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pollen-strip-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pollen-items {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.pollen-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.pollen-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pollen-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.pollen-badge.none      { background: var(--divider);  color: var(--text-secondary); }
.pollen-badge.low       { background: #4CAF50;         color: #fff; }
.pollen-badge.medium    { background: #FF9800;         color: #fff; }
.pollen-badge.high      { background: #F44336;         color: #fff; }
.pollen-badge.very-high { background: #9C27B0;         color: #fff; }

/* =============================================
   FORECAST CARD
   ============================================= */
.forecast-card {
  margin: 0 14px;
  background: var(--card-bg);
  border-radius: 22px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  padding-bottom: 4px;
}

/* --- Hourly scroll --- */
.hourly-scroll {
  display: flex;
  overflow-x: auto;
  padding: 14px 10px 12px;
  gap: 6px;
  scrollbar-width: none;
}

.hourly-scroll::-webkit-scrollbar { display: none; }

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 14px;
  flex-shrink: 0;
  transition: background 0.2s;
  min-width: 62px;
}

.hourly-item:first-child {
  background: var(--hourly-active-bg);
}

.hourly-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.hourly-icon {
  font-size: 22px;
  line-height: 1;
}

.hourly-rain {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 2px;
}

.hourly-wind {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 2px;
}

.wind-dir {
  display: inline-block;
  transform: rotate(var(--deg));
  font-size: 11px;
  line-height: 1;
  color: var(--accent);
}

.wind-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.3px;
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--divider);
  margin: 0 16px;
}

/* --- Daily list --- */
.daily-list {
  padding: 8px 0 4px;
}

.daily-item {
  display: flex;
  align-items: center;
  padding: 8px 18px;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 10px;
}

.daily-item:hover {
  background: var(--divider);
}

.daily-item--active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-left: 3px solid var(--accent);
  padding-left: 15px;
}

.daily-item:not(:last-child) {
  border-bottom: 1px solid var(--divider);
}

.daily-day {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 42px;
}

.daily-rain {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  min-width: 36px;
}

.daily-wind {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  flex: 1;
  min-width: 80px;
}

.daily-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.daily-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.daily-temp {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 60px;
  text-align: right;
  letter-spacing: 0.3px;
}

.daily-temp .temp-min {
  color: var(--text-muted);
  font-weight: 400;
}

/* --- More button --- */
.more-btn {
  display: block;
  margin: 10px auto 8px;
  background: var(--accent-btn);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 9px 36px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 155, 212, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.more-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 155, 212, 0.45);
}

/* =============================================
   RECOMMENDATION CARD
   ============================================= */
.rec-card {
  margin: 14px 14px 0;
  background: var(--rec-card-bg);
  border-radius: 22px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--rec-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px 18px 14px;
}

.rec-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.rec-icon {
  font-size: 18px;
}

.rec-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.rec-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rec-columns {
  display: flex;
  gap: 12px;
}

.rec-col {
  flex: 1;
}

.rec-type-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  display: inline-block;
}

.endurance-label {
  background: rgba(59, 155, 212, 0.15);
  color: var(--accent-btn);
}

.training-label {
  background: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
}

body.dark .training-label {
  color: #81C784;
}

.rec-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rec-list li {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}


.rec-warnings {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rec-warning {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--warning-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* =============================================
   SIDE MENU
   ============================================= */
.menu-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  border-radius: 36px;
}

.menu-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.side-menu {
  position: absolute;
  top: 0;
  right: -110%;
  width: 82%;
  height: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 200;
  border-radius: 0 36px 36px 0;
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.25);
}

.side-menu.open {
  right: 0;
}

.side-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-menu-header span {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.close-menu-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.2s;
}

.close-menu-btn:hover { color: var(--text-primary); }

.search-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-section input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--divider);
  border-radius: 12px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

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

.search-section input:focus {
  border-color: var(--accent);
}

#search-btn {
  background: var(--accent-btn);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s;
}

#search-btn:hover { opacity: 0.85; }

.geo-btn {
  background: none;
  border: 1.5px solid var(--divider);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.geo-btn:hover {
  border-color: var(--accent);
  background: rgba(59, 155, 212, 0.05);
}

.theme-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--divider);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-btn);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (min-width: 480px) {
  .app-wrapper {
    margin-top: 16px;
  }
}

@media (max-width: 420px) {
  .phone-card {
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
  }
  body {
    padding: 0;
    align-items: stretch;
  }
  .app-wrapper {
    max-width: 100%;
  }
  .menu-overlay, .side-menu {
    border-radius: 0;
  }
}

/* =============================================
   PWA iOS — standalone (ajouté à l'écran d'accueil)
   ============================================= */
@media (display-mode: standalone) {
  .app-header {
    /* Espace pour la barre de statut iOS (Dynamic Island / notch) */
    padding-top: calc(env(safe-area-inset-top, 20px) + 12px);
  }
  .phone-card {
    border-radius: 0;
    min-height: 100dvh;
    box-shadow: none;
    overflow-y: auto;   /* scroll autorisé en mode app */
    overflow-x: hidden;
    /* Espace pour la barre home iOS en bas */
    padding-bottom: calc(env(safe-area-inset-bottom, 16px) + 16px);
  }
  body {
    padding: 0;
    align-items: stretch;
    /* Débordement sous le notch */
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  .app-wrapper {
    max-width: 100%;
  }
  .side-menu {
    /* Le menu latéral tient aussi compte du notch */
    padding-top: calc(env(safe-area-inset-top, 20px) + 20px);
  }
}
