/* ===========================================
   JJMAP DESIGN SYSTEM 2.0 (Premium Native)
   =========================================== */
:root {
    /* --- PALETTE --- */
    --primary: #CD2026;
    /* Jimmy John's Red */
    --primary-dark: #A0151A;
    --accent: #28a745;
    /* Success Green */
    --accent-blue: #007AFF;
    /* iOS Blue */

    /* --- SURFACE & GLASS --- */
    --bg-body: #f8f9fa;
    --glass-surface: rgba(255, 255, 255, 0.60);
    /* More transparent */
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: blur(20px);

    /* --- TYPOGRAPHY --- */
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --text-main: #1c1c1e;
    --text-secondary: #8e8e93;

    /* --- SHADOWS --- */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);

    /* --- SPACING & SIZING --- */
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --touch-target: 48px;
    /* Fat-finger friendly */
}

/* ===========================================
   BASE STYLES
   =========================================== */
* {
    box-sizing: border-box;
    /* Prevent padding overflow */
}

html,
body {
    height: 100%;
    /* Dynamic viewport height */
    margin: 0;
    padding: 0;
    font-family: var(--font-stack);
    background: var(--bg-body);
    color: var(--text-main);
    overflow: hidden;
    overflow-x: hidden;
    /* Prevent side scroll */
    -webkit-tap-highlight-color: transparent;
    /* Remove tap flash */
}

/* ===========================================
   MAP CONTAINER
   =========================================== */
#map {
    height: 100dvh;
    width: 100%;
    z-index: 1;
    /* Base layer */
}

/* ===========================================
   PREMIUM SEARCH BAR (Floating Glass)
   =========================================== */
/* ===========================================
   PREMIUM SEARCH BAR (Floating Glass)
   ===========================================*/
/* SEARCH BAR CONTAINER */
#top-search {
    position: fixed;
    top: 50px;
    /* Below status bar */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 450px;
    height: 50px;
    background: white;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 2000;
    /* Super high to prevent blocking */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Expand search bar when focused */
#top-search:focus-within {
    width: 95%;
    transform: translateX(-50%) translateY(0);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

#pac-input {
    flex: 1;
    border: none;
    outline: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-right: 8px;
    /* Space before Go button */
    display: block;
    /* Default hidden */
    align-items: center;
    justify-content: center;
}

#search-trigger-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

#search-trigger-btn:active {
    transform: scale(0.9);
}

#pac-input::placeholder {
    color: #8e8e93;
}

#pac-input:focus {
    background: #ffffff;
    /* Solid when typing */
    box-shadow: var(--shadow-lg);
    transform: scale(1.02);
}

/* ===========================================
   CONTENT PANEL (Sheet)
   =========================================== */
#content-panel {
    position: fixed;
    bottom: 80px;
    left: 0;
    width: 100%;
    height: auto;
    max-height: 35dvh;

    background: rgba(255, 255, 255, 0.95);
    /* Keep panel solid for reading text */
    /* Only search was requested transparent */
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
    z-index: 25;
    transform: translateY(120%);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), max-height 0.3s ease;
    display: flex;
    flex-direction: column;
}

#content-panel.visible {
    transform: translateY(0);
}

#content-panel.full-screen {
    max-height: 88dvh;
}

/* --- DRAG HANDLE --- */
#panel-handle-area {
    width: 100%;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: grab;
}

#panel-handle {
    width: 36px;
    height: 5px;
    background: #E5E5EA;
    /* iOS Handle Color */
    border-radius: 3px;
}

/* ===========================================
   LIST ITEMS (Hotspots/Recent)
   =========================================== */
.view-section {
    padding: 0 16px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

h4 {
    margin: 16px 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.recent-item,
.rank-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    margin-bottom: 8px;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    min-height: var(--touch-target);
}

/* Tactile Feedback */
.recent-item:active,
.rank-item:active {
    transform: scale(0.97);
    background: #f2f2f7;
}

.rank-badge {
    background: var(--primary);
    color: white;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-right: 12px;
}

/* ===========================================
   ROUTE SLOTS (Drag & Drop)
   =========================================== */
.route-slot {
    background: #ffffff;
    border: 2px dashed #d1d1d6;
    margin-bottom: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    min-height: 56px;
    transition: all 0.2s;
}

@keyframes popIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.route-slot.filled {
    border: 2px solid var(--accent);
    background: #effff4;
    color: var(--text-main);
    border-style: solid;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.route-slot:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.slot-number {
    color: var(--text-secondary);
    font-weight: 700;
    width: 28px;
}

/* ===========================================
   SKELETON LOADING (Shimmer)
   =========================================== */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-row {
    height: 48px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    background: #f0f0f0;
    background-image: linear-gradient(90deg,
            #f0f0f0 25%,
            #e8e8e8 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

/* ===========================================
   PERSISTENT FOOTER
   =========================================== */
#persistent-route-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.6);
    /* Translucent */
    backdrop-filter: blur(10px);
    z-index: 30;
}

.mini-slot-row {
    display: flex;
    gap: 8px;
}

.mini-slot {
    flex: 1;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.04);
    color: #c7c7cc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.mini-slot.filled {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ===========================================
   BOTTOM NAVIGATION (Minimal)
   =========================================== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    /* Shorter for max map */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn .icon {
    font-size: 24px;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn:active {
    transform: scale(0.9);
    /* Tactile shrink */
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    margin-top: 2px;
}

/* ===========================================
   UTILITY & BUTTONS
   =========================================== */
.action-btn-primary {
    width: 100%;
    height: 50px;
    background: var(--text-main);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    margin-top: 16px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.1s;
}

.action-btn-primary:active {
    transform: scale(0.97);
}

.verdict-box {
    display: none;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    color: white;
    box-shadow: var(--shadow-lg);
    z-index: 20;
    text-align: center;
    font-size: 14px;
    white-space: nowrap;
}

.verdict-go {
    background: var(--accent);
}

.verdict-stop {
    background: var(--primary);
}

/* ===========================================
   VERDICT CARD (CRITICAL DATA)
   =========================================== */
#verdict-card {
    position: fixed;
    bottom: 90px;
    /* Above nav bar */
    left: 20px;
    right: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
    padding: 16px;
    z-index: 100;
    /* Above everything */
    display: none;
    /* Hidden by default */
    border-left: 6px solid #ccc;
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#verdict-card.show {
    display: block;
}

.verdict-header {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.verdict-sub {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.verdict-actions {
    display: flex;
    gap: 10px;
}

.v-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.v-btn-add {
    background: #28a745;
    color: white;
}

.v-btn-clear {
    background: #eee;
    color: #333;
}

/* --- MAP LABEL OVERLAYS (Reset to standard) --- */
.map-label-standard {
    text-shadow:
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff;
    /* Outline hack for standard markers */
}

/* Desktop Sidebar Mods (Optional, kept minimal) */
/* Tablet layout removed */

/* DESKTOP LAYOUT (> 1025px) */
/* Desktop/Tablet overrides removed */

/* Route Panel CSS Removed */

/* Ensure autocomplete is on top of search bar */
.pac-container {
    z-index: 100000 !important;
}