/* ═══════════════════════════════════════════════════════════
   Alpes-Maritimes MTB Trails — Stylesheet
   Full-screen map layout with floating menu & video card
═══════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ── */
:root {
  --bg-primary:        #080a0d;
  --bg-secondary:      #0d1117;
  --surface-glass:     rgba(10, 13, 18, 0.82);
  --surface-glass-hover: rgba(18, 23, 32, 0.92);
  --border-glass:      rgba(255, 255, 255, 0.08);
  --border-accent:     rgba(16, 185, 129, 0.4);

  --text-primary:   #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted:     #6b7280;

  --diff-easy:         #3b82f6;
  --diff-intermediate: #3b82f6;
  --diff-advanced:     #3b82f6;
  --diff-expert:       #3b82f6;

  --color-primary:      #3b82f6;
  --color-primary-glow: rgba(59, 130, 246, 0.25);
  --color-strava:       #fc5200;
  --color-youtube:      #ff0000;

  --font-display: 'Outfit', sans-serif;
  --font-body:    'Inter', sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast:   0.2s;
  --t-normal: 0.3s;
  --t-smooth: 0.5s var(--ease-out);

  --shadow-glass: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow:  0 0 18px rgba(16,185,129,0.2);
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── App Shell ── */
#app-container {
  position: relative;
  width: 100vw; height: 100vh;
  overflow: hidden;
}

/* ── Map (full screen) ── */
#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #090c10;
}

/* ── Glassmorphism utility ── */
.glass-panel {
  background: var(--surface-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: var(--shadow-glass);
}

/* ═══════════════════════════════════════
   FLOATING MENU (top-left)
═══════════════════════════════════════ */
#floating-menu-container {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 20;
  width: 320px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#floating-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-container {
  flex-shrink: 0;
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--color-primary), #2563eb);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(59,130,246,0.3);
}

.brand-logo-container i {
  font-size: 17px;
  color: white;
  transform: rotate(-15deg);
  transition: transform var(--t-fast);
}

.brand-logo-container:hover i { transform: rotate(0deg) scale(1.1); }

#brand-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(to right, #fff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.3;
}

#floating-social {
  display: flex;
  gap: 6px;
}

.social-pill {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  text-decoration: none;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.social-pill.strava  { background: linear-gradient(135deg, #fc5200, #c94200); }
.social-pill.youtube { background: linear-gradient(135deg, #ff0000, #c00000); }
.social-pill:hover   { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

/* Trail Selector Button */
#menu-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.4);
  border-radius: 10px;
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: left;
}

#menu-toggle-btn:hover {
  background: rgba(59,130,246,0.18);
  border-color: rgba(59,130,246,0.6);
  box-shadow: 0 0 18px rgba(59,130,246,0.2);
}

#menu-toggle-btn i:first-child { font-size: 14px; }

#menu-label { flex: 1; }

#menu-chevron {
  font-size: 11px;
  transition: transform var(--t-normal);
}

#menu-toggle-btn[aria-expanded="true"] #menu-chevron {
  transform: rotate(180deg);
}

/* Trail Dropdown List */
#floating-trail-menu {
  background: rgba(8,10,14,0.97);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  overflow: hidden;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#floating-trail-menu.hidden { display: none; }

.menu-trail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--t-fast);
  text-decoration: none;
}

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

.menu-trail-item:hover {
  background: rgba(255,255,255,0.05);
}

.menu-trail-item.active {
  background: rgba(59,130,246,0.08);
}

.menu-diff-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.menu-trail-info {
  flex: 1;
  min-width: 0;
}

.menu-trail-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-trail-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.menu-diff-badge {
  display: none;
}

/* ═══════════════════════════════════════
   DETAIL CARD (right slide-in)
═══════════════════════════════════════ */
#details-drawer {
  position: absolute;
  top: 20px; right: 20px;
  width: 650px;
  z-index: 20;
  padding: 28px;
  transform: translateX(calc(100% + 40px));
  transition: transform var(--t-smooth);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#details-drawer.open {
  transform: translateX(0);
  pointer-events: auto;
}

.drawer-scroll-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(8,10,13,0.7);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all var(--t-fast);
}

.close-btn:hover {
  background: rgba(239,68,68,0.85);
  border-color: transparent;
  transform: scale(1.1);
}

/* ── Trail Title ── */
.drawer-header-content h2 {
  font-size: 32px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  margin: 0;
}

/* ── Video section ── */
.video-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}

.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: none;
}

/* Hide all the extra sections */
.drawer-stats-grid,
.elevation-profile-section,
.drawer-description,
.drawer-subtitle-row {
  display: none;
}

/* ── Action Buttons ── */
.drawer-actions {
  padding: 0;
  background: transparent;
  border: none;
}

.action-btn-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
}

.btn i {
  font-size: 18px;
}

.btn-pov {
  background: linear-gradient(135deg, #ff0000, #c00000);
  color: white;
  box-shadow: 0 4px 16px rgba(255,0,0,0.3);
}

.btn-pov:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255,0,0,0.5);
  filter: brightness(1.15);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-glass);
  color: white;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

.btn-strava {
  background: linear-gradient(135deg, #fc5200, #c94200);
  color: white;
  box-shadow: 0 4px 16px rgba(252,82,0,0.3);
}

.btn-strava:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(252,82,0,0.5);
  filter: brightness(1.15);
}

/* ── Trail Difficulty Badges ── */
.trail-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.trail-badge.easy        { background: rgba(16,185,129,0.15); color: #34d399; }
.trail-badge.intermediate{ background: rgba(59,130,246,0.15);  color: #60a5fa; }
.trail-badge.advanced    { background: rgba(239,68,68,0.15);   color: #f87171; }
.trail-badge.expert      { background: rgba(168,85,247,0.15);  color: #c084fc; }

/* ── Leaflet overrides ── */
.leaflet-control-zoom {
  border: 1px solid var(--border-glass) !important;
  box-shadow: var(--shadow-glass) !important;
  border-radius: 10px !important;
  overflow: hidden;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  background: var(--surface-glass) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-glass) !important;
  transition: background var(--t-fast) !important;
  backdrop-filter: blur(12px) !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background: var(--surface-glass-hover) !important;
  color: var(--color-primary) !important;
}

.leaflet-control-layers {
  background: var(--surface-glass) !important;
  backdrop-filter: blur(14px) !important;
  border: 1px solid var(--border-glass) !important;
  box-shadow: var(--shadow-glass) !important;
  border-radius: 12px !important;
  color: var(--text-primary) !important;
  font-family: var(--font-display) !important;
  font-size: 12px !important;
  padding: 6px !important;
}

.leaflet-control-layers-expanded {
  padding: 10px 14px !important;
  background: rgba(10,13,18,0.96) !important;
  border: 1px solid rgba(59,130,246,0.4) !important;
}

.leaflet-control-layers-list label {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--t-fast);
}

.leaflet-control-layers-list label:hover { color: white; }
.leaflet-control-layers-selector { accent-color: var(--color-primary); cursor: pointer; }

.custom-tooltip {
  background: var(--bg-secondary) !important;
  border: 1px solid rgba(59,130,246,0.4) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-display) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 5px 11px !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-glass) !important;
}

/* ── Map Markers ── */
.custom-marker-icon { display: flex; align-items: center; justify-content: center; }

.marker-pin {
  width: 28px; height: 28px;
  border-radius: 50% 50% 50% 0;
  background: var(--color-primary);
  position: absolute;
  transform: rotate(-45deg);
  left: 50%; top: 50%;
  margin: -14px 0 0 -14px;
  border: 2px solid white;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  transition: all var(--t-fast);
}

.marker-pin::after {
  content: '';
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-primary);
  position: absolute;
}

.marker-icon-inner {
  position: absolute;
  z-index: 10;
  font-size: 11px;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
}

.custom-marker-icon.easy         .marker-pin { background: var(--diff-easy); }
.custom-marker-icon.easy         .marker-icon-inner { color: var(--diff-easy); }
.custom-marker-icon.intermediate .marker-pin { background: var(--diff-intermediate); }
.custom-marker-icon.intermediate .marker-icon-inner { color: var(--diff-intermediate); }
.custom-marker-icon.advanced     .marker-pin { background: var(--diff-advanced); }
.custom-marker-icon.advanced     .marker-icon-inner { color: var(--diff-advanced); }
.custom-marker-icon.expert       .marker-pin { background: var(--diff-expert); }
.custom-marker-icon.expert       .marker-icon-inner { color: var(--diff-expert); }

.custom-marker-icon.active .marker-pin {
  transform: rotate(-45deg) scale(1.25);
  box-shadow: 0 0 14px rgba(255,255,255,0.5);
  border-color: #fff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #floating-menu-container { width: calc(100vw - 40px); }

  #details-drawer {
    top: auto; bottom: 0;
    right: 0; left: 0;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    transform: translateY(100%);
    padding: 20px;
  }

  #details-drawer.open { transform: translateY(0); }

  .drawer-header-content h2 {
    font-size: 24px;
  }
}
