/* Variables (modo oscuro por defecto) */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #161b33;
    --accent: #ff6b35;
    --accent-hover: #ff8c42;
    --text: #e8eaf6;
    --text-muted: #9fa8da;
    --success: #00e676;
    --border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box
}

html,
body,
#map {
    height: 100%
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.panel {
    background: rgba(22, 27, 51, 0.7);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px
}

.logo {
    width: 44px;
    height: 44px
}

.header h1 {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px
}

.btn-icon {
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    font-size: 1.1rem
}

/* Mobile toggle button (hidden on desktop) */
.toggle-sidebar{display:none;background:transparent;border:0;color:var(--text);font-size:1.2rem;padding:6px}

.counter {
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700
}

.app-layout {
    display: flex;
    height: calc(100vh - 110px);

/* Footer link styling for better contrast on dark background */
.footer a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.footer a:hover,
.footer a:focus {
    color: var(--accent-hover);
    outline: 3px solid rgba(255, 107, 53, 0.12);
    outline-offset: 2px;
    border-radius: 6px;
}
    gap: 12px;
    padding: 80px 12px 12px 12px
}

.sidebar {
    width: 340px;
    max-width: 90vw;
    overflow: hidden;
    display: flex;
    flex-direction: column
}

.sidebar .search {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    margin-bottom: 10px
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px
}

.filters label {
    font-size: 0.9rem;
    color: var(--text-muted)
}

.list {
    overflow: auto;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    margin-top: 6px
}

.list .item {
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer
}

.list .item:hover {
    background: rgba(255, 255, 255, 0.02)
}

.list .item .meta {
    font-size: 0.9rem;
    color: var(--text-muted)
}

.map-container {
    flex: 1;
    position: relative
}

#map {
    position: absolute;
    inset: 0;
    border-radius: 12px
}

.footer {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px
}

/* Popup custom */
.popup-custom {
    min-width: 200px
}

.popup-custom .popup-header {
    display: flex;
    align-items: center;
    gap: 8px
}

.popup-custom .badge {
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    padding: 4px 8px;
    border-radius: 999px;
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem
}

.popup-custom h4 {
    margin: 6px 0 4px;
    color: var(--text)
}

.popup-custom .address {
    color: var(--text-muted);
    margin: 0 0 8px
}

.btn-directions {
    display: inline-block;
    padding: 6px 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    text-decoration: none
}

/* User marker pulse */
.user-marker .pulse {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(255, 107, 53, 0.6)
}

/* Responsive */
@media (max-width: 768px) {
    .app-layout { padding-top: 76px }

    /* Sidebar as off-canvas panel */
    .sidebar{
        position:fixed;
        left:-110%;
        top:72px;
        height:calc(100vh - 144px);
        z-index:1202;
        width:86vw;
        transition:left .28s, transform .28s;
        transform:translateX(0);
    }
    .sidebar.active{ left:6px; transform:translateX(0) }

    /* Overlay that appears when sidebar is open */
    .overlay{ position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:1201; opacity:0; pointer-events:none; transition:opacity .18s }
    .overlay.active{ opacity:1; pointer-events:auto }

    /* Toggle/close buttons */
    .toggle-sidebar{ display:inline-flex; align-items:center; justify-content:center }
    .close-sidebar{ display:inline-flex; align-items:center; justify-content:center; position:absolute; right:12px; top:12px; background:transparent; border:0; color:var(--text); font-size:1.2rem }

    /* Compact header on mobile */
    .header h1{ font-size:1rem }
    .header .counter{ display:none }

    /* Slightly smaller sidebar width and padding for phone screens */
    .sidebar .search{ padding:10px }
}

/* Leaflet tweaks to better integrate dark theme */
.leaflet-popup-content-wrapper {
    background: rgba(22, 27, 51, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 10px
}

.leaflet-control-attribution,
.leaflet-control-scale {
    color: var(--text-muted)
}

/* Tour / stepper styles */
.tour-overlay{
        position:fixed;inset:0;background:rgba(0,0,0,0.6);z-index:1400;display:none;align-items:center;justify-content:center;padding:20px
}
.tour-overlay[aria-hidden="false"]{display:flex}
.tour{background:linear-gradient(180deg,rgba(22,27,51,0.98),rgba(16,18,36,0.98));color:var(--text);border-radius:12px;padding:18px;max-width:720px;width:100%;box-shadow:0 8px 30px rgba(0,0,0,0.6);border:1px solid var(--border)}
.tour h3{margin:0 0 8px;font-size:1.15rem}
.tour-content{min-height:120px;padding:8px 0}
.tour-step{display:none}
.tour-step.active{display:block}
.tour-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px}
.tour-dots{display:flex;gap:6px;flex:1;justify-content:center}
.tour-dots .dot{width:10px;height:10px;border-radius:50%;background:rgba(255,255,255,0.12)}
.tour-dots .dot.active{background:var(--accent)}
.tour-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}
.btn-primary{background:var(--accent);border:0;color:#fff;padding:8px 12px;border-radius:8px;cursor:pointer}
.btn-link{background:transparent;border:0;color:var(--text-muted);cursor:pointer}

@media (max-width:480px){
    .tour{max-width:94vw;padding:12px}
    .tour h3{font-size:1rem}
}