/* --- Base Dark Theme Styles --- */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
}

#map {
    height: 100vh;
    width: 100vw;
    z-index: 1;
}

/* Invert OpenStreetMap tiles for a seamless dark map */
.leaflet-layer,
.leaflet-control-zoom-in,
.leaflet-control-zoom-out,
.leaflet-control-attribution {
    filter: invert(100%) hue-rotate(180deg) brightness(90%) contrast(90%);
}

/* --- Settings Overlay --- */
#settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden { display: none !important; }

.settings-content {
    background: #1e1e1e;
    padding: 24px 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    border: 1px solid #333;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.settings-header h2 { margin: 0; font-size: 20px; font-weight: 600; color: #fff;}

#close-settings-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: color 0.2s;
}
#close-settings-btn:hover { color: #fff; }

hr {
    border: 0;
    border-top: 1px solid #333;
    margin: 20px 0;
}

/* --- Custom Pretty Inputs --- */
.setting-row { margin-bottom: 16px; }
.setting-label { font-size: 15px; font-weight: 500; color: #e0e0e0; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; }

/* 1. Toggle Switch (iOS Style) */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #444;
    transition: .3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider { background-color: #007aff; }
input:checked + .slider:before { transform: translateX(20px); }

/* 2. Custom Radio Buttons */
.custom-radio {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 32px;
    margin-bottom: 14px;
    cursor: pointer;
    font-size: 15px;
    user-select: none;
    color: #ccc;
}
.custom-radio:hover { color: #fff; }
.custom-radio input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}
.radio-mark {
    position: absolute;
    top: 0; left: 0;
    height: 20px; width: 20px;
    background-color: #1e1e1e;
    border: 2px solid #555;
    border-radius: 50%;
    transition: 0.2s;
}
.custom-radio:hover input ~ .radio-mark { border-color: #888; }
.custom-radio input:checked ~ .radio-mark { border-color: #007aff; }
.radio-mark:after {
    content: "";
    position: absolute;
    display: none;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #007aff;
}
.custom-radio input:checked ~ .radio-mark:after { display: block; }

/* --- Floating Controls Container --- */
.floating-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Space between the buttons */
}

/* Update your existing floating-btn to remove its fixed positioning */
.floating-btn {
    position: relative; /* Changed from fixed */
    background: #1e1e1e;
    color: #ffffff;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.1s, border-color 0.2s;
}

/* Primary Apply Button */
.primary-btn {
    width: 100%;
    padding: 14px;
    background: #007aff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.2s;
}
.primary-btn:hover { background: #0062cc; }

/* Location Picking States */
.picking-location {
    cursor: crosshair !important; /* Change mouse pointer when selecting */
}
.btn-active {
    background: #007aff !important;
    border-color: #007aff !important;
    color: #ffffff !important;
}

/* ==========================================
   FOOD FILTER CAROUSEL (Uniform Solid Theme)
   ========================================== */

.food-filter-container {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 90vw;
    z-index: 1000;
    
    display: flex;
    gap: 6px;
    padding: 8px;
    overflow-x: auto;
    
    /* Matches your floating buttons perfectly */
    background: #1e1e1e; 
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.food-filter-container::-webkit-scrollbar { 
    display: none; 
}

/* --- Individual Filter Card (Inactive State) --- */
.food-filter-card {
    flex: 0 0 auto;
    width: 65px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    
    /* Subtle depth for inactive cards */
    background-color: #222222; 
    border: 1px solid #2a2a2a; 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); 
    
    display: flex;
    flex-direction: column;
}

.food-filter-card:active { 
    transform: scale(0.95); 
}

/* --- Hover State --- */
.food-filter-card:hover {
    background-color: #2a2a2a; 
    border-color: #3a3a3a; 
}

/* --- Active/Selected State --- */
.food-filter-card.active {
    background-color: #3d3d3d; 
    border-color: #555555; 
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5); 
    transform: translateY(-2px);
}

/* --- Image Styling --- */
.food-filter-card img {
    width: 100%;
    height: 40px;
    object-fit: cover;
    display: block;
    pointer-events: none;
    opacity: 0.6; /* Dimmer when inactive to push to background */
    transition: opacity 0.2s;
}

/* Bring images to full color when hovered or active */
.food-filter-card.active img,
.food-filter-card:hover img {
    opacity: 1; 
}

/* --- Text Styling --- */
.food-filter-card span {
    display: block;
    text-align: center;
    padding: 6px 2px;
    font-size: 11px;
    font-weight: 500;
    color: #999999; /* Dim text for inactive */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.food-filter-card:hover span {
    color: #e0e0e0;
}

/* Crisp white text for the active item */
.food-filter-card.active span {
    color: #ffffff;
    font-weight: 600;
}

/* =========================================
   Dark Mode Theme for Leaflet Popups
   Matches Reference: Dark Grey + Subtle Border
   ========================================= */

/* 1. Main Container and Content Wrapper */
.leaflet-popup-content-wrapper {
  background: #212121 !important; /* Dark grey background from reference */
  border: 1px solid #333333 !important; /* Subtle, slightly lighter grey border from reference */
  border-radius: 4px !important; /* Soft corners, matching the reference buttons */
  color: #EFEFEF !important; /* Off-white text and content */
  box-shadow: 0 3px 14px rgba(0,0,0,0.4) !important; /* Darker, deeper shadow */
  font-family: inherit; /* Use your project's font */
}

/* 2. Content Padding */
.leaflet-popup-content {
  margin: 12px 16px !important; /* Balanced internal padding, similar to the reference buttons */
  line-height: 1.4 !important;
}

/* 3. The Tip (Arrow) */
.leaflet-popup-tip-container {
  /* Leaflet's tip positioning can be tricky. This standard styling works best. */
}

.leaflet-popup-tip {
  background: #212121 !important; /* Must match the main content-wrapper background exactly */
  border: 1px solid #333333 !important; /* Adds a border to the exposed side of the arrow triangle */
  /* This creates a continuous border effect from the box down the arrow.
     The border will only show on the visible edges of the arrow triangle. */
}

/* 4. The Close Button ('X') */
.leaflet-popup-close-button {
  color: #EFEFEF !important; /* Off-white close 'X' */
  font-size: 16px !important;
  font-weight: bold;
  opacity: 0.7; /* Soften the default look */
}

.leaflet-popup-close-button:hover {
  color: #FFFFFF !important; /* Pure white on hover */
  opacity: 1;
}
