/* ============================================
   CSS CUSTOM PROPERTIES & DESIGN TOKENS
   ============================================ */
:root {
    /* Colors */
    --color-primary: #FFD700;
    --color-primary-light: #FFE44D;
    --color-secondary: #FFA500;
    --color-bg-dark: #0a0e27;
    --color-bg-medium: #1a1f3a;
    --color-bg-darker: #050714;
    --color-text-primary: rgba(255, 255, 255, 0.95);
    --color-text-secondary: rgba(255, 255, 255, 0.7);
    --color-text-muted: rgba(255, 255, 255, 0.5);
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 50%;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(255, 215, 0, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Z-index Layers */
    --z-map: 1;
    --z-panel: 998;
    --z-sidebar: 999;
    --z-header: 1000;
    --z-modal: 2000;
    --z-loading: 3000;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--color-bg-dark) 0%, var(--color-bg-medium) 50%, var(--color-bg-darker) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   MAP CONTAINER
   ============================================ */
.map-container {
    position: relative;
    width: 100%;
    height: 100vh;
}

#map {
    width: 100%;
    height: 100%;
    z-index: var(--z-map);
}

/* ============================================
   HEADER - Enhanced Glassmorphism
   ============================================ */
.map-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    padding: var(--space-md) var(--space-xl);
    z-index: var(--z-header);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.map-header.scrolled {
    background: rgba(10, 14, 39, 0.95);
    padding: var(--space-sm) var(--space-xl);
}

.map-header h1 {
    color: var(--color-secondary);
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    letter-spacing: -0.02em;
}

.map-header h1 i {
    font-size: 1.3rem;
    filter: drop-shadow(0 0 8px rgb(255, 217, 0));
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* ============================================
   BUTTONS - Improved Interactions
   ============================================ */
.btn {
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    min-height: 40px;
    touch-action: manipulation;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: var(--color-bg-dark);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-primary);
    border: 1px solid rgba(255, 215, 0, 0.25);
    backdrop-filter: blur(4px);
}

.btn-secondary:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   MODAL - Enhanced Animations
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background: linear-gradient(135deg, var(--color-bg-medium), var(--color-bg-dark));
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: all var(--transition-normal) cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal h2 {
    color: var(--color-primary);
    margin-bottom: var(--space-lg);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
}

/* ============================================
   FORM ELEMENTS - Better UX
   ============================================ */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid rgba(255, 215, 0, 0.2);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: rgba(255, 215, 0, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(255, 215, 0, 0.08);
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.modal-actions .btn {
    flex: 1;
}

/* ============================================
   SIDEBAR - Smooth Slide Animation
   ============================================ */
.notes-sidebar {
    position: fixed;
    right: -420px;
    top: 80px;
    width: 400px;
    max-width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    background: rgba(10, 14, 39, 0.92);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-left: 1px solid rgba(255, 215, 0, 0.15);
    z-index: var(--z-sidebar);
    transition: right var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: var(--space-lg);
    box-shadow: var(--shadow-lg);
}

.notes-sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1;
}

.sidebar-header h3 {
    color: var(--color-primary);
    font-size: 1.2rem;
    font-weight: 700;
}

.close-sidebar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-sidebar:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
    color: var(--color-primary);
    transform: rotate(90deg);
}

/* ============================================
   NOTE CARDS - Enhanced Design
   ============================================ */
.note-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.12);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.note-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--color-primary), var(--color-secondary));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.note-card:hover {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.35);
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.note-card:hover::before {
    opacity: 1;
}

/* Add this to the end of css/map.css */
.note-card.hidden {
    display: none !important;
}

/* Ensure the search bar looks right in the sidebar */
.sidebar-search {
    margin-bottom: 15px;
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--space-sm);
    gap: var(--space-sm);
}

.note-author {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.note-time {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.note-text {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: var(--space-sm);
}

.note-link {
    color: var(--color-secondary);
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.note-link:hover {
    color: var(--color-primary);
    gap: 6px;
}

.btn-delete-note {
    background: rgba(255, 68, 68, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 68, 68, 0.3);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: var(--space-sm);
    width: 100%;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.btn-delete-note:hover {
    background: rgba(255, 68, 68, 0.25);
    border-color: rgba(255, 68, 68, 0.5);
    color: #ff8888;
}

/* ============================================
   LOCATION POPUP - Modern Card Style
   ============================================ */
.location-popup {
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    min-width: 250px;
    box-shadow: var(--shadow-lg);
    animation: popupFadeIn 0.2s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-title {
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: var(--space-sm);
    font-size: 1rem;
}

.popup-text {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.popup-link {
    color: var(--color-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.popup-link:hover {
    color: var(--color-primary);
    gap: 6px;
}

.note-popup {
    text-align: center;
    min-width: 150px;
}

.popup-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.btn-directions {
    background: rgba(40, 167, 69, 0.15);
    color: #4ade80;
    border: 1px solid rgba(40, 167, 69, 0.3);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    flex: 1;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.btn-directions:hover {
    background: rgba(40, 167, 69, 0.25);
    border-color: rgba(40, 167, 69, 0.5);
}

/* Hide default OSRM instruction box */
.leaflet-routing-container {
    display: none !important; 
}
/* ============================================
   MODERN NOTE POPUP STYLES
   ============================================ */

/* Main Popup Container Override */
.leaflet-popup-content-wrapper {
    background: rgba(15, 20, 40, 0.98);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.1);
    color: #fff;
    padding: 0; /* Remove default padding to control it inside */
}

.leaflet-popup-tip {
    background: rgba(15, 20, 40, 0.98);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: none;
}

.leaflet-popup-content {
    margin: 0;
    width: 280px !important; /* Fixed width for consistency */
}

/* Popup Inner Content */
.note-popup {
    padding: 16px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    text-align: left;
}

/* Header Section */
.note-popup h4 {
    color: #FFD700;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

/* Note Text */
.note-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 12px 0;
    font-style: normal;
}

/* Contact Link */
.note-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #a78bfa; /* Soft Purple for contact */
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 4px 8px;
    background: rgba(167, 139, 250, 0.1);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.note-link:hover {
    background: rgba(167, 139, 250, 0.2);
    color: #c4b5fd;
    transform: translateY(-1px);
}

/* Date Stamp */
.note-date {
    display: block;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Action Buttons Container */
.popup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Equal width buttons */
    gap: 10px;
    margin-top: 8px;
}

/* Shared Button Styles */
.btn-directions, 
.btn-delete-note {
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    width: 100%;
}

/* Get Directions Button (Primary Action) */
.btn-directions {
    background: linear-gradient(135deg, #10b981, #059669); /* Emerald Green */
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-directions:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    filter: brightness(1.1);
}

.btn-directions:active {
    transform: translateY(0);
}

/* Delete Button (Secondary/Danger Action) */
.btn-delete-note {
    background: rgba(239, 68, 68, 0.15); /* Soft Red Background */
    color: #fca5a5; /* Light Red Text */
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-delete-note:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
    border-color: rgba(239, 68, 68, 0.5);
}

/* Icon styling within buttons */
.btn-directions i, 
.btn-delete-note i {
    font-size: 0.9rem;
}
/* ============================================
   SEARCH BAR - Enhanced
   ============================================ */
.search-container {
    position: relative;
    margin-top: var(--space-md);
    max-width: 400px;
    margin: 1rem 0;
}

.search-container input {
    width: 100%;
    padding: var(--space-sm) var(--space-md) var(--space-sm) 45px;
    border-radius: 25px;
    border: 1.5px solid rgba(255, 215, 0, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-normal);
    backdrop-filter: blur(4px);
}

.search-container input::placeholder {
    color: var(--color-text-muted);
}

.search-container input:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 215, 0, 0.4);
}

.search-container input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.15), var(--shadow-glow);
}

.search-container i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

.search-container input:focus + i {
    color: var(--color-primary);
}

/* ============================================
   NEAREST LOCATIONS PANEL
   ============================================ */
.nearest-panel {
    position: fixed;
    bottom: var(--space-lg);
    left: var(--space-lg);
    background: rgba(10, 14, 39, 0.92);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    z-index: var(--z-panel);
    max-width: 320px;
    display: none;
    box-shadow: var(--shadow-lg);
    animation: slideUpFade 0.3s ease-out;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nearest-panel.active {
    display: block;
}

.nearest-panel h4 {
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
}

.nearest-item {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 1px solid transparent;
}

.nearest-item:hover {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateX(4px);
}

.nearest-distance {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.nearest-info {
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    margin-top: var(--space-xs);
}

/* ============================================
   LOADING SPINNER - Enhanced
   ============================================ */
.loading-spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-loading);
}

.loading-spinner.active {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 215, 0, 0.15);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    box-shadow: var(--shadow-glow);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.bottom-box {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 15rem;
  height: 0.9rem;
  color: black;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  border-radius: 0.2rem;
}

/* ============================================
   CUSTOM MARKERS - Polished
   ============================================ */
.leaflet-marker-icon {
    z-index: 1000 !important;
}

.custom-marker, 
.user-location-marker {
    background: transparent;
    border: none;
}

.custom-marker {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border: 3px solid #fff;
    border-radius: var(--radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.3);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.custom-marker:hover {
    transform: scale(1.25);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.7), 0 0 30px rgba(255, 215, 0, 0.5);
}

.user-location-marker {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: 3px solid #fff;
    border-radius: var(--radius-full);
    width: 28px;
    height: 28px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 6px 25px rgba(76, 175, 80, 0.7);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ============================================
   ONBOARDING INSTRUCTION MODAL
   ============================================ */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 20, 0.85); /* Darker backdrop for focus */
    backdrop-filter: blur(8px);
    z-index: 9999; /* Highest priority */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.onboarding-overlay.active {
    opacity: 1;
    visibility: visible;
}

.onboarding-card {
    background: linear-gradient(145deg, #1a1f3a, #0a0e27);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 215, 0, 0.1);
    transform: scale(0.8) translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.onboarding-overlay.active .onboarding-card {
    transform: scale(1) translateY(0);
}

/* Decorative glow behind card */
.onboarding-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.onboarding-icon {
    font-size: 3rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.onboarding-title {
    color: var(--color-primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.onboarding-steps {
    text-align: left;
    margin: 1.5rem 0;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

.step-item:last-child {
    margin-bottom: 0;
}

.step-item i {
    color: var(--color-secondary);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.btn-start-map {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: #0a0e27;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    width: 100%;
    margin-top: 10px;
}

.btn-start-map:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.5);
    filter: brightness(1.1);
}

/* Mobile adjustment */
@media (max-width: 480px) {
    .onboarding-card {
        padding: 1.5rem;
    }
    .onboarding-title {
        font-size: 1.3rem;
    }
}

/* ============================================
   RESPONSIVE DESIGN - Mobile First & Tablet
   ============================================ */

/* Tablet & Small Laptops (Max Width 1024px) */
@media (max-width: 1024px) {
    .notes-sidebar {
        width: 350px; /* Slightly narrower on tablets */
    }
    
    .nearest-panel {
        max-width: 280px;
    }
}

/* Mobile Devices (Max Width 768px) */
@media (max-width: 768px) {
    :root {
        /* Adjust spacing for tighter mobile layouts */
        --space-xl: 1.25rem;
        --space-lg: 1rem;
        --space-md: 0.75rem;
    }

    /* --- Header Adjustments --- */
    .map-header {
        padding: var(--space-sm);
        flex-wrap: wrap; /* Allow wrapping if needed */
        gap: var(--space-sm);
    }

    .map-header h1 {
        font-size: 1.1rem;
        order: 1; /* Title first */
        flex: 1;
    }

    .header-actions {
        order: 2; /* Buttons second */
        width: 100%;
        justify-content: space-between;
        margin-top: var(--space-xs);
    }

    /* --- Sidebar Transformation (Full Screen Drawer) --- */
    .notes-sidebar {
        width: 100%;
        right: -100%; /* Start fully off-screen */
        top: 0; /* Cover header too for immersive feel, or keep top: 60px */
        height: 100vh;
        border-left: none;
        border-radius: 0;
        z-index: 2000; /* Above everything except modal */
        padding-top: 70px; /* Space for fixed header */
    }

    .notes-sidebar.active {
        right: 0;
    }

    /* --- Modal Adjustments --- */
    .modal {
        width: 95%;
        max-width: none;
        margin: var(--space-md);
        padding: var(--space-lg);
        max-height: 85vh;
    }

    /* --- Map Popups --- */
    .leaflet-popup-content-wrapper {
        border-radius: 12px;
        margin-bottom: 15px !important; /* Ensure arrow doesn't overlap content */
    }
    
    .leaflet-popup-content {
        width: 240px !important; /* Smaller width for mobile screens */
        margin: 10px;
    }

    .popup-actions {
        flex-direction: column; /* Stack buttons vertically on mobile */
        gap: var(--space-sm);
    }

    .btn-directions, 
    .btn-delete-note {
        width: 100%;
        padding: 12px; /* Larger touch target */
    }

    /* --- Nearest Locations Panel --- */
    .nearest-panel {
        left: var(--space-md);
        right: var(--space-md);
        bottom: var(--space-md);
        max-width: none; /* Full width minus margins */
        border-radius: var(--radius-lg);
    }

    /* --- Toast Notifications --- */
    .toast {
        left: var(--space-md);
        right: var(--space-md);
        bottom: var(--space-md);
        max-width: none;
        width: auto;
    }
    
    /* --- Form Elements --- */
    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}

/* Small Mobile Devices (Max Width 480px) */
@media (max-width: 480px) {
    .map-header h1 span {
        display: none; /* Hide long text, keep icon */
    }
    
    .map-header h1::after {
        content: 'Map'; /* Shorter title fallback if needed */
        margin-left: 5px;
    }

    .btn {
        padding: var(--space-xs) var(--space-sm);
        min-height: 36px;
        font-size: 0.85rem;
    }

    /* Hide button text, show only icons to save space */
    .header-actions .btn span {
        display: none;
    }
    
    .header-actions .btn i {
        margin: 0;
        font-size: 1.1rem;
    }

    /* Adjust sidebar header for small screens */
    .sidebar-header h3 {
        font-size: 1.1rem;
    }
}

/* Very Small Devices (Max Width 360px) */
@media (max-width: 360px) {
    .map-header {
        padding: var(--space-xs);
    }
    
    .custom-marker {
        width: 28px;
        height: 28px; /* Smaller markers for tiny screens */
    }
}