/* =========================================================
   🌓 Theme Variables & Global Styles
   ========================================================= */
:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --card-bg: #ffffff;
    --sidebar-bg: rgba(255, 255, 255, 0.98);
    --border-color: #eeeeee;
    --input-bg: #f8f9fa;
    --shadow: rgba(0, 0, 0, 0.12);
    --overlay-bg: rgba(0, 0, 0, 0.4);

    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #28a745;
    --danger-color: #dc3545;

    --radius-medium: 16px;
    --radius-large: 20px;
    --radius-extra-large: 24px;
    --transition-fast: 0.2s ease;
}

body.dark-theme {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --sidebar-bg: rgba(30, 30, 30, 0.98);
    --border-color: #333333;
    --input-bg: #2a2a2a;
    --shadow: rgba(0, 0, 0, 0.5);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    background: var(--bg-color);
    overflow: hidden;
    height: 100vh;
}

/* =========================================================
   🏙 Map & Interface
   ========================================================= */
#map {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100vh;
    z-index: 1;
}

.leaflet-popup-content-wrapper {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-radius: var(--radius-medium) !important;
    box-shadow: 0 10px 30px var(--shadow) !important;
}

/* =========================================================
   🔎 Search Experience & Dynamic Nav
   ========================================================= */
.search-experience-wrapper {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 600px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Logic for disappearing search bar */
.search-experience-wrapper.results-active .search-bar {
    display: none;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 6px 6px 6px 15px; 
    border-radius: 50px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px var(--shadow);
}

.search-bar select {
    border: none;
    background: transparent;
    padding-right: 10px;
    color: var(--text-color);
    border-right: 1px solid var(--border-color);
    outline: none;
    font-size: 13px;
    font-weight: 600;
    height: 32px;
    cursor: pointer;
}

.search-input-group {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 15px;
    color: var(--text-color);
    outline: none;
    min-width: 0;
}

#clearSearch {
    cursor: pointer;
    padding: 0 10px;
    font-size: 20px;
    color: #888;
    line-height: 1;
}

#searchBtn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0 22px;
    height: 38px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    transition: background var(--transition-fast);
}

/* =========================================================
   📜 Results & New Search Trigger
   ========================================================= */
#results {
    max-height: 75vh;
    overflow-y: auto;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#results::-webkit-scrollbar { display: none; }

.new-search-trigger {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-medium);
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease;
}

.new-search-trigger:active { transform: scale(0.97); }

/* =========================================================
   📦 Detailed Business Cards
   ========================================================= */
.business-card {
    background: var(--card-bg);
    border-radius: var(--radius-medium);
    padding: 18px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 25px var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.card-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-color);
}

.distance-tag {
    font-size: 12px;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 10px;
    background: var(--input-bg);
}

.card-body {
    margin-bottom: 15px;
}

.card-address {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-desc {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.7;
    margin-bottom: 8px;
}

.card-phone {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.btn-action {
    padding: 10px 5px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.btn-action.call { background: rgba(40, 167, 69, 0.1); color: var(--secondary-color); }
.btn-action.directions { background: var(--primary-color); color: white; border: none; }

/* =========================================================
   🔐 Auth Slide Panel
   ========================================================= */
.slide-panel {
    position: fixed;
    top: 0; right: -100%; bottom: 0;
    width: 400px; max-width: 100%;
    background: var(--sidebar-bg);
    z-index: 3000;
    padding: 30px 25px;
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px var(--shadow);
}

.slide-panel.active { right: 0; }

.close-btn {
    position: absolute; top: 15px; right: 20px;
    background: none; border: none; font-size: 32px;
    color: var(--text-color); cursor: pointer;
}

#authPanelContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 60px; 
    gap: 15px; 
}

#authPanelContent button, .auth-btn {
    width: 100%;
    padding: 14px 18px; 
    border-radius: var(--radius-medium);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-weight: 700;
    font-size: 14px; 
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* =========================================================
   🔘 Floating Controls
   ========================================================= */
#userLocation {
    position: fixed; top: 20px; left: 20px; z-index: 1050;
    background: var(--card-bg); padding: 7px 15px; border-radius: 30px;
    box-shadow: 0 4px 15px var(--shadow); font-size: 11px; font-weight: 900;
    color: var(--text-color); border: 1px solid var(--border-color);
}

.dark-mode-toggle, #authPanelToggle {
    position: fixed; top: 20px; z-index: 1050;
    width: 42px; height: 42px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px var(--shadow); border: none;
}

.dark-mode-toggle { right: 20px; background: var(--card-bg); color: var(--text-color); }
#authPanelToggle { right: 70px; background: var(--primary-color); color: white; }

.auth-initial { font-weight: 800; font-size: 16px; }

#authPanelOverlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--overlay-bg); backdrop-filter: blur(4px);
    z-index: 2900; display: none; opacity: 0; transition: opacity 0.3s;
}

#authPanelOverlay.active { display: block; opacity: 1; }

.loading {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 50px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 4px 15px var(--shadow);
}

/* =========================================================
   📱 Mobile Optimization
   ========================================================= */
@media (max-width: 600px) {
    .search-experience-wrapper { top: 75px; width: 94%; }
    #userLocation { top: 15px; left: 15px; }
    #authPanelToggle { top: 15px; right: 15px; }
    .dark-mode-toggle { top: 15px; right: 65px; }
    .slide-panel { width: 100%; }
    .card-actions { grid-template-columns: 1fr 1fr; }
    .btn-action.directions { grid-column: span 2; }

    
}