/* ======================== */
/*  ABC Ashrafieh Demo CSS  */
/* ======================== */

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --accent: #ff6d00;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #5f6368;
    --border: #e0e0e0;
    --success: #0f9d58;
    --danger: #ea4335;
    --shadow: 0 2px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --header-h: 60px;
    --beacon-color: #7c4dff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.hidden { display: none !important; }

/* =========== SPLASH =========== */
.splash {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.splash.fade-out {
    opacity: 0;
    transform: scale(1.05);
}
.splash-content { text-align: center; color: white; }
.splash-logo {
    font-size: 72px; font-weight: 800;
    letter-spacing: 8px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.splash-sub {
    font-size: 18px; font-weight: 300;
    letter-spacing: 12px;
    margin-top: -4px;
    opacity: 0.8;
}
.splash-tagline {
    font-size: 14px; font-weight: 400;
    margin-top: 20px;
    opacity: 0.6;
}
.splash-loader {
    width: 200px; height: 3px;
    background: rgba(255,255,255,0.2);
    margin: 24px auto 0;
    border-radius: 2px;
    overflow: hidden;
}
.loader-bar {
    height: 100%; width: 0;
    background: white;
    border-radius: 2px;
    animation: loadBar 2s ease forwards;
}
@keyframes loadBar { to { width: 100%; } }

/* =========== APP =========== */
.app {
    height: 100vh; width: 100vw;
    display: flex; flex-direction: column;
    position: relative;
}

/* =========== HEADER =========== */
.header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.logo-mark {
    background: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 18px;
    padding: 6px 10px;
    border-radius: 8px;
    letter-spacing: 2px;
}
.title-main { display: block; font-weight: 700; font-size: 16px; }
.title-sub { display: block; font-size: 11px; color: var(--text-secondary); font-weight: 400; }

.icon-btn {
    border: none; background: transparent;
    cursor: pointer; padding: 8px;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--primary-light); color: var(--primary); }

/* =========== FLOOR SELECTOR =========== */
.floor-selector {
    position: absolute;
    top: calc(var(--header-h) + 12px);
    right: 16px;
    z-index: 50;
    display: flex; flex-direction: column; gap: 4px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 4px;
}
.floor-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}
.floor-btn .material-icons-round { font-size: 16px; }
.floor-btn:hover { background: var(--primary-light); }
.floor-btn.active { background: var(--primary); color: white; }

/* =========== MAP =========== */
.map-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #eef2f7;
}
#mapCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}
#mapCanvas:active { cursor: grabbing; }

/* =========== PROMO POPUP =========== */
.promo-popup {
    position: absolute;
    z-index: 60;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}
.promo-popup.show {
    pointer-events: auto;
    animation: promoIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes promoIn {
    from { opacity: 0; transform: scale(0.5) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.promo-bubble {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 10px 14px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    border-left: 3px solid var(--accent);
    min-width: 140px;
    max-width: 200px;
}
.promo-close {
    position: absolute;
    top: -6px; right: -6px;
    width: 18px; height: 18px;
    background: var(--text-secondary);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    line-height: 1;
}
.promo-icon { font-size: 20px; flex-shrink: 0; }
.promo-text { font-size: 11px; font-weight: 600; color: var(--accent); }
.promo-store { font-size: 10px; color: var(--text-secondary); }

/* =========== NAV HUD =========== */
.nav-hud {
    position: absolute;
    top: calc(var(--header-h) + 12px);
    left: 16px; right: 80px;
    z-index: 55;
}
.nav-hud-content {
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-instruction { display: flex; align-items: center; gap: 8px; flex: 1; }
.nav-arrow {
    font-size: 28px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    padding: 4px;
}
.nav-direction { display: block; font-weight: 600; font-size: 14px; }
.nav-distance { display: block; font-size: 12px; opacity: 0.8; }
.nav-dest { font-size: 12px; opacity: 0.8; white-space: nowrap; }
.nav-cancel {
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    display: flex; align-items: center; gap: 4px;
    transition: background 0.2s;
}
.nav-cancel:hover { background: rgba(255,255,255,0.3); }
.nav-cancel .material-icons-round { font-size: 16px; }

/* =========== BOTTOM PANEL =========== */
.bottom-panel {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    padding: 0 16px 16px;
    pointer-events: none;
}
.bottom-panel > * { pointer-events: auto; }

.search-bar {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    position: relative;
}
.search-icon { color: var(--text-secondary); font-size: 22px; }
.search-bar input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: transparent;
}
.search-bar input::placeholder { color: #aab0b8; }

.search-results {
    position: absolute;
    bottom: 100%;
    left: 0; right: 0;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 6px;
    max-height: 260px;
    overflow-y: auto;
}
.search-result-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--primary-light); }
.search-result-icon { font-size: 24px; }
.search-result-name { font-weight: 600; font-size: 14px; }
.search-result-cat { font-size: 12px; color: var(--text-secondary); }

.quick-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.action-chip {
    border: none;
    background: var(--surface);
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    color: var(--text);
}
.action-chip:hover { background: var(--primary); color: white; }
.action-chip .material-icons-round { font-size: 18px; }

/* =========== DRAWER =========== */
.drawer {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.drawer-header h2 { font-size: 20px; font-weight: 700; }

.drawer-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
}
.filter-chip {
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--text-secondary);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.store-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.store-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}
.store-list-item:hover { background: var(--primary-light); }
.store-list-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.store-list-info { flex: 1; }
.store-list-name { font-weight: 600; font-size: 15px; }
.store-list-detail { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.store-list-nav {
    border: none;
    background: var(--primary-light);
    color: var(--primary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    display: flex; align-items: center; gap: 4px;
    transition: all 0.2s;
}
.store-list-nav:hover {
    background: var(--primary);
    color: white;
}
.store-list-nav .material-icons-round { font-size: 14px; }

/* =========== SETTINGS =========== */
.settings-list { padding: 16px 20px; }
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
}
.setting-label {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; font-weight: 500;
}
.setting-label .material-icons-round {
    font-size: 20px;
    color: var(--text-secondary);
}
.setting-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}
.setting-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}
.setting-hint {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    text-align: center;
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px; height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    cursor: pointer;
    background: #ccc;
    border-radius: 24px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Move Controls */
.move-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.move-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.move-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text);
    transition: all 0.15s;
}
.move-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.move-btn:active { transform: scale(0.92); }
.move-center-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--primary);
    margin: 0 8px;
}

/* =========== MODAL =========== */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 300;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-icon { font-size: 48px; color: var(--primary); }
.modal-content h3 { margin-top: 12px; font-size: 20px; }
.modal-content p { margin-top: 8px; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.modal-spot {
    margin-top: 12px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    display: inline-block;
}
.modal-btn {
    margin-top: 20px;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    padding: 12px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.2s;
}
.modal-btn:hover { background: var(--primary-dark); }

/* =========== STORE CARD =========== */
.store-card {
    position: absolute;
    bottom: 140px;
    left: 16px; right: 16px;
    z-index: 60;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    animation: slideCardUp 0.3s ease;
}
@keyframes slideCardUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.store-card-header {
    display: flex; align-items: center; gap: 12px;
}
.store-card-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.store-card-info { flex: 1; }
.store-card-info h3 { font-size: 17px; font-weight: 700; }
.store-card-info p { font-size: 12px; color: var(--text-secondary); }
.store-card-details { margin-top: 12px; }
.store-detail-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-secondary);
    margin-top: 6px;
}
.store-detail-row .material-icons-round { font-size: 18px; }
.store-card-nav {
    margin-top: 14px;
    width: 100%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}
.store-card-nav:hover { background: var(--primary-dark); }

/* =========== SCROLLBAR =========== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* =========== MOBILE D-PAD =========== */
.mobile-dpad {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 130px;
    height: 130px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 4px;
    z-index: 50;
    pointer-events: auto;
}
.dpad-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(26, 115, 232, 0.9);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    transition: transform 0.1s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.dpad-btn:active {
    transform: scale(0.92);
    background: rgba(21, 87, 176, 0.95);
}
.dpad-btn .material-icons-round {
    font-size: 22px;
}
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-center { 
    grid-column: 2; 
    grid-row: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(26, 115, 232, 0.3);
    border: 2px solid rgba(26, 115, 232, 0.5);
}
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

/* Hide on large screens by default, show on touch devices */
@media (hover: hover) and (pointer: fine) {
    .mobile-dpad { display: none; }
}

/* Always show on touch-capable or small screens */
@media (hover: none), (pointer: coarse), (max-width: 768px) {
    .mobile-dpad { display: grid; }
    
    .bottom-panel {
        padding-bottom: 20px;
    }
    
    .quick-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .action-chip {
        padding: 12px 18px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 24px;
        box-shadow: 0 3px 12px rgba(0,0,0,0.15);
    }
    
    .action-chip .material-icons-round {
        font-size: 20px;
    }
    
    .search-bar {
        padding: 14px 18px;
    }
    
    .search-bar input {
        font-size: 16px;
    }
}

/* =========== RESPONSIVE =========== */
@media (max-width: 500px) {
    .nav-hud { right: 70px; }
    .store-card { bottom: 180px; }
    .mobile-dpad {
        bottom: 180px;
        right: 10px;
    }
    
    .bottom-panel {
        padding: 0 12px 24px;
    }
    
    .quick-actions {
        margin-top: 12px;
    }
    
    .action-chip {
        padding: 14px 16px;
        font-size: 13px;
        flex: 1;
        justify-content: center;
        min-width: 90px;
    }
}
