/* ==========================================================================
   FloraFind Design System - Villa Buri Park Botanical Guide
   ========================================================================== */

/* Global Variable Declarations */
:root {
  /* Font Families */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  /* Color Palette (Dark Theme Default) */
  --bg-app: #050d08;
  --bg-gradient: linear-gradient(135deg, #050c08 0%, #0d2214 100%);
  --bg-glass: rgba(10, 26, 17, 0.75);
  --bg-glass-hover: rgba(16, 44, 28, 0.85);
  --border-glass: rgba(16, 185, 129, 0.15);
  --border-glass-active: rgba(16, 185, 129, 0.35);
  --text-primary: #f0fdf4;
  --text-secondary: #98bfa7;
  --text-muted: #62836f;
  
  /* Semantic Accents */
  --accent-emerald: #10b981;
  --accent-emerald-rgb: 16, 185, 129;
  --accent-gold: #d97706;
  --accent-gold-rgb: 217, 119, 6;
  --accent-blossom: #ec4899;
  --accent-fern: #22c55e;
  --accent-herb: #84cc16;
  --accent-exotic: #a855f7;
  
  /* UI Elements */
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-inset: inset 0 2px 4px 0 rgba(255, 255, 255, 0.05);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Light Theme Variables */
body.light-mode {
  --bg-app: #f2f7f4;
  --bg-gradient: linear-gradient(135deg, #eef5f0 0%, #dbeae1 100%);
  --bg-glass: rgba(255, 255, 255, 0.82);
  --bg-glass-hover: rgba(245, 250, 247, 0.9);
  --border-glass: rgba(21, 128, 61, 0.12);
  --border-glass-active: rgba(21, 128, 61, 0.28);
  --text-primary: #112d1b;
  --text-secondary: #3b6149;
  --text-muted: #64826e;
  
  --shadow-premium: 0 8px 32px 0 rgba(10, 48, 27, 0.12);
  --shadow-inset: inset 0 2px 4px 0 rgba(255, 255, 255, 0.4);
}

/* Reset and Layout */
html {
  height: 100%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
  transition: background-color 0.4s ease;
}

#app-container {
  position: absolute; /* Cambia a posizionamento assoluto */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Map Styling
   ========================================================================== */
#map {
  flex-grow: 1;
  width: 100%;
  min-height: 0; /* Fix for Safari/iOS flexbox height calculation bug */
  z-index: 1;
  background-color: var(--bg-app);
}

/* Hide Leaflet Default Zoom Controls (we build our own) */
.leaflet-control-zoom {
  display: none !important;
}
.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.5) !important;
  color: #fff !important;
  font-size: 9px !important;
  border-radius: 4px;
  padding: 0 4px !important;
}
body.light-mode .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.6) !important;
  color: #333 !important;
}

/* Custom Marker CSS */
.pulsing-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Default marker size (medium) */
.marker-medium .marker-pin { width: 20px; height: 20px; }
.marker-medium .marker-ring { width: 36px; height: 36px; }

/* Small marker size */
.marker-small .marker-pin { width: 14px; height: 14px; }
.marker-small .marker-ring { width: 28px; height: 28px; }

/* Large marker size */
.marker-large .marker-pin { width: 24px; height: 24px; }
.marker-large .marker-ring { width: 44px; height: 44px; }

.marker-pin { 
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  position: relative;
  z-index: 2;
  transition: var(--transition-spring);
} 

.marker-small .marker-pin { border-width: 2px; }
.marker-large .marker-pin { border-width: 4px; }

.marker-ring {
  position: absolute;
  border-radius: 50%;
  animation: marker-pulse 2s infinite ease-out;
  z-index: 1;
}

@keyframes marker-pulse {
  0% {
    transform: scale(0.5);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(var(--marker-color-rgb, 16, 185, 129), 0.7);
  }
  70% {
    transform: scale(1.4);
    opacity: 0.3;
    box-shadow: 0 0 0 10px rgba(var(--marker-color-rgb, 16, 185, 129), 0);
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(var(--marker-color-rgb, 16, 185, 129), 0);
  }
}

/* Active Selected Marker State */
.pulsing-marker.active-marker .marker-pin {
  transform: scale(1.3);
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px var(--accent-gold);
}

.pulsing-marker.active-marker .marker-ring {
  animation: marker-pulse-active 1.2s infinite ease-out;
}

@keyframes marker-pulse-active {
  0% {
    transform: scale(0.8);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.8);
  }
  100% {
    transform: scale(2.0);
    opacity: 0;
    box-shadow: 0 0 0 15px rgba(217, 119, 6, 0);
  }
}

/* Pulsating User Location Marker (GPS) */
.user-location-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-dot {
  width: 14px;
  height: 14px;
  background-color: #3b82f6;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
  z-index: 5;
}

.user-pulse {
  position: absolute;
  width: 40px;
  height: 40px;
  background-color: rgba(59, 130, 246, 0.25);
  border-radius: 50%;
  animation: user-pulse-anim 2s infinite ease-out;
  z-index: 4;
}

@keyframes user-pulse-anim {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* ==========================================================================
   HUD Styles (Overlays on Map)
   ========================================================================== */

/* Glassmorphism base class */
.glass {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-premium), var(--shadow-inset);
  color: var(--text-primary);
  transition: var(--transition-smooth);
}

.glass-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-premium), var(--shadow-inset);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-spring);
}

.glass-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-active);
  transform: translateY(-2px);
}

.glass-btn:active {
  transform: scale(0.95);
}

/* Top HUD Container */
.top-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none; /* Let clicks pass through to map if outside buttons */
}

.logo-area, .search-filter-container {
  pointer-events: auto; /* Enable clicks inside HUD components */
}

.logo-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-premium);
}

.brand-icon {
  color: var(--accent-emerald);
  animation: sway 4s infinite ease-in-out;
}

@keyframes sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(15deg); }
}

.brand h1 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, var(--text-primary), var(--text-secondary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

/* Search Bar styling */
.search-bar {
  display: flex;
  align-items: center;
  padding: 4px 16px;
  border-radius: var(--radius-md);
  height: 48px;
  width: 100%;
  margin-bottom: 8px;
}

.search-icon {
  color: var(--text-muted);
  margin-right: 12px;
  flex-shrink: 0;
}

.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  width: 100%;
  font-weight: 500;
}

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

.clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin-left: 8px;
}

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

.hidden {
  display: none !important;
}

/* Horizontal Category Chips */
.filter-wrapper {
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  width: 100%;
  display: flex;
}

.filter-wrapper::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.filter-chips {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
}

.chip {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.chip:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-glass-active);
}

.chip.active {
  background: var(--accent-emerald);
  color: #ffffff;
  border-color: var(--accent-emerald);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

body.light-mode .chip.active {
  color: #ffffff;
}

/* Floating HUD Right Panel Controls */
.floating-controls-right {
  position: absolute;
  right: 16px;
  bottom: 120px; /* Leave space above peek drawer */
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition-smooth);
}

.floating-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
}

.floating-btn.highlight {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}
.floating-btn.highlight:hover {
  background: #059669;
}

.quest-progress-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-gold);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.4);
  border: 1.5px solid var(--bg-app);
}

.floating-btn.active-sim {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #ffffff;
  animation: pulse-sim-btn 1.5s infinite alternate;
}

@keyframes pulse-sim-btn {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7); }
  100% { transform: scale(1.08); box-shadow: 0 0 12px 4px rgba(217, 119, 6, 0.3); }
}

/* ==========================================================================
   Mobile Swipe Bottom Sheet (Detail Drawer)
   ========================================================================== */
.drawer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20; /* Higher than map & HUD */
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 80%;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  transform: translateY(100%); /* Start hidden */
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.05); /* Smooth elastic slider */
}

/* Glassmorphic Sheet Specifics */
.glass-drawer {
  background: rgba(9, 23, 15, 0.82);
  border-top: 1px solid var(--border-glass-active);
  border-left: 1px solid var(--border-glass);
  border-right: 1px solid var(--border-glass);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
}

body.light-mode .glass-drawer {
  background: rgba(255, 255, 255, 0.88);
  border-top: 1px solid rgba(21, 128, 61, 0.2);
}

/* Active Drawer states */
.drawer.peek {
  transform: translateY(calc(100% - 100px)); /* Peak height */
}

.drawer.full {
  height: 65vh; /* Set an explicit height */
  transform: translateY(0%); /* Slide it fully into view */
}

.drawer-handle-bar {
  width: 100%;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none; /* Handle touch drags ourselves in JS */
  flex-shrink: 0;
}

.drawer-handle-bar:active {
  cursor: grabbing;
}

.drawer-handle {
  width: 44px;
  height: 5px;
  background-color: var(--text-muted);
  border-radius: 3px;
  opacity: 0.7;
}

.drawer-content {
  flex-grow: 1;
  /* overflow: auto; */ /* Moved to drawer-body-details */
  min-height: 0; /* Fix for flexbox scroll container height calculation */
  display: flex;
  flex-direction: column;
}

/* Peek Header styling */
.drawer-header-peek {
  padding: 0 20px 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-glass);
  height: 72px;
}

.header-main-info h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-main-info p {
  font-size: 13px;
  font-style: italic;
  color: var(--text-secondary);
  font-weight: 500;
}

.rarity-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(var(--accent-emerald-rgb), 0.15);
  border: 1px solid rgba(var(--accent-emerald-rgb), 0.4);
  color: var(--accent-emerald);
}

.rarity-badge.rare {
  background: rgba(var(--accent-gold-rgb), 0.15);
  border-color: rgba(var(--accent-gold-rgb), 0.4);
  color: var(--accent-gold);
}

.rarity-badge.exotic {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.4);
  color: var(--accent-exotic);
}

/* Scrollable Detail Body */
.drawer-body-details {
  padding: 20px;
  overflow-y: auto; /* Enable vertical scroll on this container */
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
}

/* Custom Image Card Area */
.plant-image-showcase {
  width: 100%;
}

.plant-media-card {
  width: 100%;
  aspect-ratio: 16 / 9; /* Mantiene una proporzione widescreen costante */
  height: auto; /* L'altezza si adatterà alla larghezza per mantenere l'aspect-ratio */
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(13, 27, 18, 0.3) 100%);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

/* Dynamic custom generated layout in place of images */
.plant-media-card img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Mostra l'intera immagine senza ritagliarla */
}

.leaf-shadow-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bg-leaf-icon {
  width: 80px;
  height: 80px;
  color: var(--border-glass-active);
  opacity: 0.4;
  animation: breathe 3s infinite ease-in-out;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 0.5; }
}

/* Dynamic Info Banner inside Card */
.plant-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
}

.plant-card-family {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-emerald);
}

/* Characteristics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

body.light-mode .stat-card {
  background: rgba(0, 0, 0, 0.02);
}

.stat-icon {
  width: 18px;
  height: 18px;
  margin-bottom: 2px;
}

.stat-icon.sun { color: #f59e0b; }
.stat-icon.water { color: #3b82f6; }
.stat-icon.height { color: #10b981; }
.stat-icon.origin { color: #84cc16; }

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Detail Description Block */
.details-section h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.details-section p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Botanical Fun Fact Card */
.fun-fact-box {
  background: rgba(217, 119, 6, 0.06);
  border: 1px dashed rgba(217, 119, 6, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.light-mode .fun-fact-box {
  background: rgba(217, 119, 6, 0.04);
}

.fun-fact-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-gold);
}

.fun-fact-header h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fun-fact-box p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  font-style: italic;
}

/* Actions panel containing control buttons */
.drawer-actions-panel {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.action-btn {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-spring);
}

.primary-action {
  background: var(--accent-emerald);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.primary-action:hover {
  background: #059669;
  transform: translateY(-2px);
}

.primary-action:disabled, .primary-action.disabled {
  background: var(--border-glass-active);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass-active);
  color: var(--text-primary);
}

body.light-mode .secondary-action {
  background: rgba(0, 0, 0, 0.03);
}

.secondary-action:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.secondary-action.active-audio {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #3b82f6;
  animation: audio-glow 1.5s infinite alternate;
}

@keyframes audio-glow {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.2); }
  100% { box-shadow: 0 0 10px 2px rgba(59, 130, 246, 0.4); }
}

/* ==========================================================================
   Modals (Quest overlay)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50; /* Topmost */
  background: rgba(2, 8, 4, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: zoom-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

@keyframes zoom-in {
  from { transform: scale(0.9) translateY(20px); }
  to { transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-icon {
  color: var(--accent-gold);
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.modal-body {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Quest Progress Container */
.quest-summary-panel p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.quest-progress-bar-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quest-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

#quest-progress-text {
  color: var(--accent-gold);
}

.quest-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  overflow: hidden;
}

body.light-mode .quest-progress-bar {
  background: rgba(0,0,0,0.05);
}

#quest-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-gold));
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Quest Checklist Items */
.quest-checklist-wrapper h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.quest-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quest-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-smooth);
  cursor: pointer;
}

body.light-mode .quest-item {
  background: rgba(0, 0, 0, 0.01);
}

.quest-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-glass-active);
}

.quest-item-info {
  display: flex;
  flex-direction: column;
}

.quest-item-name {
  font-size: 14px;
  font-weight: 600;
}

.quest-item-scientific {
  font-size: 11px;
  font-style: italic;
  color: var(--text-muted);
}

.quest-check {
  font-size: 14px;
  font-weight: 800;
}

.quest-check.pending {
  color: var(--text-muted);
}

.quest-check.checked {
  color: var(--accent-emerald);
}

.quest-item.completed {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.04);
}

/* Celebrate Confetti Trigger styles (classes added in script) */
.celebrate-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: var(--bg-glass);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  padding: 30px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 15px 50px rgba(0,0,0,0.6);
  pointer-events: none;
}

.celebrate-popup.active {
  animation: pop-celebrate 2.5s ease-out forwards;
}

@keyframes pop-celebrate {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  20% { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
  85% { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

/* ==========================================================================
   Responsive Viewports Configuration (Desktop View)
   ========================================================================== */
@media screen and (min-width: 769px) {
  /* On desktop, we keep the drawer at the bottom, but we can make it wider */
  .drawer {
    left: 20px;
    right: 20px;
  }
  
  .drawer:not(.full) {
    /* Assicura che il drawer si nasconda quando non è in stato 'full' su desktop */
    transform: translateY(100%);
  }

  .drawer-handle-bar {
    display: none; /* No drag handle on desktop side menu */
  }
  
  .drawer-header-peek {
    padding-top: 20px;
    height: 90px;
  }

  /* Adjust top bar width and alignment */
  .top-hud {
    width: calc(100% - 440px); /* Leave room for sidebar */
    max-width: 600px;
  }

  .search-filter-container {
    flex-direction: row;
    gap: 12px;
  }

  .search-bar {
    margin-bottom: 0;
    flex-grow: 1;
  }

  .filter-wrapper {
    width: auto;
  }
  
  .drawer-body-details {
    padding-top: 10px;
  }

  .plant-media-card {
    aspect-ratio: 16 / 9; /* Mantiene la proporzione anche su desktop */
  }
}
