/* ===================================
   MODERN MAP & FLOATING CARD DESIGN
   ================================== */

/* Main container for the map section */
/* This overrides the default card styling to become a viewport-like container */
#current-objective.map-panel {
  position: relative;
  width: 100%;
  height: 75vh; /* Tall map view */
  min-height: 500px;
  padding: 0;
  border-radius: 24px;
  overflow: hidden;
  background: #e5e7eb; /* Placeholder grey */
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
  margin-bottom: 40px;
}

/* The Map itself - full background */
#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}

/* Remove old skip links visual clutter (keep accessible) */
.map-accessibility-actions {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2000;
  pointer-events: none;
}
.map-skip-link {
  pointer-events: auto;
}

/* ===================================
   FLOATING BOTTOM CARD
   ================================== */

.current-place-section {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  margin: 0 auto;
  max-width: 480px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 24px;
  z-index: 1000;
  /* Animation for sliding up */
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(0,0,0,0.04);
}

/* Navigation Header (Arrows + Counter) */
.current-place-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 0;
  border-bottom: none;
}

/* Navigation Buttons (Arrows) */
.current-place-navigation button {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.current-place-navigation button:hover {
  background: #f9fafb;
  transform: scale(1.05);
  border-color: #d1d5db;
}

.current-place-navigation button:active {
  transform: scale(0.95);
}

/* "X / Y" Counter Style styling */
.current-place-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: #9ca3af;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ===================================
   CONTENT TYPOGRAPHY
   ================================== */

.current-place-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#currentPlaceName {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #166534;
  line-height: 1.2;
  font-family: 'Jost', sans-serif;
}

.spinner-small {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

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

/* Badges Row */
.place-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.badge-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-type {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.badge-xp {
  background: #0ea5e9; /* Bright blue */
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3);
  border: none;
}

.badge-trophy {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #ffedd5;
  display: flex;
  align-items: center;
  gap: 4px;
}

#currentPlaceDescription {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #4b5563;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Limit description to 3 lines initially */
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===================================
   ACTION BUTTONS
   ================================== */

.current-place-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.current-place-actions button {
  height: 44px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  cursor: pointer;
  padding: 0 12px;
}

/* Primary Action (Check-in) */
.current-place-actions button.btn.primary {
  background: #0284c7; /* Vivid Blue */
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.current-place-actions button.btn.primary:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

/* Secondary Actions (Outline) */
.current-place-actions button.btn.secondary {
  background: white;
  border: 1px solid #e5e7eb;
  color: #374151;
}

.current-place-actions button.btn.secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* Icon styling inside buttons - Add fontawesome or similar if needed, or simple SVG */
.btn-icon-svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ===================================
   RESPONSIVE ADJUSTMENTS (BOTTOM SHEET REDESIGN)
   ================================== */

@media (max-width: 768px) {
  /* Map takes full viewport height relative to its container */
  #current-objective.map-panel {
    height: calc(100vh - 70px); /* Subtract header height approx */
    max-height: none;
    border-radius: 0;
    margin-bottom: 0;
    border: none;
  }

  /* Leaflet Controls Position Adjustment */
  /* Move zoom controls to top-right to avoid covering bottom sheet */
  .leaflet-top.leaflet-left {
    top: 10px;
    left: auto;
    right: 10px;
  }
  
  .leaflet-control-zoom {
    margin-top: 60px !important; /* Push down below any top overlays */
  }

  /* Bottom Sheet Container */
  .current-place-section {
    position: absolute; /* Absolute within map panel */
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    
    background: #ffffff;
    border-radius: 24px 24px 0 0; /* Rounded top corners only */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 20px 24px 24px 24px;
    z-index: 1000;
    
    /* Ensure it sits above map */
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  /* Navigation Row (Arrows & Counter) - Integrated into Sheet Header */
  .current-place-navigation {
    margin-bottom: 16px;
    justify-content: center; /* Center the counter */
    gap: 20px;
    position: relative;
  }
  
  .current-place-navigation button {
    width: 36px;
    height: 36px;
    background: #f3f4f6; /* Subtle grey background */
    border: none;
    font-size: 1.1rem;
  }
  
  .current-place-heading {
    font-size: 0.9rem;
    color: #6b7280;
  }

  /* Content Typography */
  #currentPlaceName {
    font-size: 1.3rem;
    margin-bottom: 4px;
  }

  /* Description - Truncate to 2 lines to save space */
  #currentPlaceDescription {
    font-size: 0.9rem;
    margin-bottom: 16px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    color: #6b7280;
  }
  
  /* Badges Row */
  .place-badges {
    margin-bottom: 12px;
  }

  /* Actions Layout - Compact Row */
  .current-place-actions {
    display: grid;
    grid-template-columns: 1fr auto auto; /* Main button + 2 icon buttons */
    gap: 12px;
    grid-template-areas: "check comments nav";
    margin-top: 0;
  }
  
  /* Check-in Button (Primary) */
  .current-place-actions button:nth-child(1) { 
    grid-area: check;
    height: 48px; /* Taller touch target */
    font-size: 1rem;
  }
  
  /* Secondary Buttons (Icon only or compact) */
  .current-place-actions button.btn.secondary {
    padding: 0;
    width: 48px; /* Square buttons */
    height: 48px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
  }
  
  .current-place-actions button.btn.secondary span:not(.btn-icon) {
    display: none; /* Hide text label on mobile */
  }
  
  .current-place-actions button.btn.secondary .btn-icon {
    font-size: 1.2rem;
    margin: 0;
  }

  /* Hide XP badge if it clutters, or keep small */
  .badge-xp {
    font-size: 0.65rem;
    padding: 3px 8px;
  }
}

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

/* ===================================
   USER LOCATION MARKER (Blue Dot)
   ================================== */
.user-location-marker {
  background: transparent !important;
  border: none !important;
}

.user-dot {
  position: relative;
  width: 24px;
  height: 24px;
}

.user-dot-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #3b82f6;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.5);
  z-index: 2;
}

.user-dot-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background: rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  animation: userPulse 2s ease-out infinite;
  z-index: 1;
}

@keyframes userPulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

/* ===================================
   MOBILE LEAFLET POPUP OPTIMIZATION
   ================================== */
@media (max-width: 768px) {
  .leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  }

  .leaflet-popup-content {
    margin: 0;
    width: 240px !important;
    max-width: 240px !important;
  }

  /* All Popup Images - very compact */
  .leaflet-popup-content img {
    height: 80px !important;
    max-height: 80px !important;
    width: 100%;
    object-fit: cover;
    border-radius: 12px 12px 0 0 !important;
    margin-bottom: 0 !important;
  }

  /* Popup Content Text */
  .leaflet-popup-content h3 {
    font-size: 0.95rem !important;
    margin: 8px 10px 4px !important;
    line-height: 1.2;
  }

  .leaflet-popup-content p {
    font-size: 0.8rem !important;
    margin: 0 10px 8px !important;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Compact Buttons in Popups */
  .leaflet-popup-content button,
  .leaflet-popup-content a[style*="background"] {
    margin: 0 10px 10px !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    height: auto !important;
    width: calc(100% - 20px) !important;
  }

  /* Close Button */
  .leaflet-container a.leaflet-popup-close-button {
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    padding: 0;
  }

  /* ===================================
     RECOMMENDATION POPUP SPECIFIC
     ================================== */
  .recommendation-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
  }
  
  .recommendation-popup .leaflet-popup-content {
    width: 220px !important;
    max-width: 220px !important;
  }
  
  /* Rec popup image */
  .rec-map-popup img {
    height: 70px !important;
    max-height: 70px !important;
    margin-bottom: 6px !important;
    border-radius: 8px !important;
  }
  
  /* Rec popup category row */
  .rec-map-popup > div:first-of-type {
    font-size: 10px !important;
    margin-bottom: 4px !important;
  }
  
  /* Rec popup title */
  .rec-map-popup h3 {
    font-size: 0.9rem !important;
    margin: 0 0 4px 0 !important;
  }
  
  /* Rec popup location */
  .rec-map-popup > div:nth-of-type(2) {
    font-size: 11px !important;
    margin-bottom: 6px !important;
  }
  
  /* Rec popup button */
  .rec-map-popup button {
    padding: 8px 10px !important;
    font-size: 0.8rem !important;
    border-radius: 6px !important;
  }
}
