/* ==========================================================================
   PCRU Campus Map CSS Design - Vanilla CSS
   Theme: Dark Forest Green & Gold Accent (University Colors)
   Aesthetics: Glassmorphism, Neon Glows, Smooth Micro-animations
   ========================================================================== */

/* Design Tokens & CSS Variables */
:root {
    --bg-dark: #070d0a;
    --bg-sidebar: rgba(13, 22, 17, 0.82);
    --border-glass: rgba(16, 185, 129, 0.18);
    --border-glass-active: rgba(251, 191, 36, 0.4);
    --scroll-pct: 0;
    
    --color-primary: #059669; /* Deep Emerald Green */
    --color-primary-light: #10b981; /* Emerald Green */
    --color-accent: #fbbf24; /* University Gold */
    --color-accent-dark: #d97706; /* Dark Gold/Amber */
    
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #0f172a;
    
    --shadow-glow: 0 0 15px rgba(16, 185, 129, 0.25);
    --shadow-glow-gold: 0 0 20px rgba(251, 191, 36, 0.45);
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    
    --font-main: 'Outfit', 'Sarabun', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
}

/* Application Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* 1. Sidebar Navigation */
.sidebar {
    width: 380px;
    height: 100%;
    background: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-glass);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

/* Sidebar Header */
.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
}

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

.brand-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 1px;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.brand-details h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-details p {
    font-size: 0.75rem;
    color: var(--color-accent);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
    border-bottom: 2px solid transparent;
}

.tab-btn i {
    width: 16px;
    height: 16px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    background: rgba(16, 185, 129, 0.05);
}

/* Tab Content Areas */
.tab-content-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.2) transparent;
}

.tab-content-container::-webkit-scrollbar {
    width: 6px;
}

.tab-content-container::-webkit-scrollbar-thumb {
    background-color: rgba(16, 185, 129, 0.2);
    border-radius: 3px;
}

.tab-content {
    display: none;
    padding: 20px;
    animation: fadeIn 0.2s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Search Box Container */
.search-box {
    margin-bottom: 18px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

#search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px 16px 12px 42px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

#search-input:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
    background: rgba(0, 0, 0, 0.6);
}

.clear-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.clear-btn:hover {
    color: var(--text-primary);
}

/* Category Filter Pills */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-main);
    transition: var(--transition-smooth);
}

.filter-pill:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.filter-pill.active {
    background: var(--color-primary);
    color: var(--text-primary);
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-glow);
}

/* Building List Styling */
.building-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-header {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.building-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.building-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}

.building-item:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--border-glass);
    transform: translateX(4px);
}

.building-item.selected {
    background: rgba(251, 191, 36, 0.08);
    border-color: var(--color-accent);
}

.item-id {
    min-width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.building-item:hover .item-id {
    background: var(--color-primary-light);
}

.building-item.selected .item-id {
    background: var(--color-accent);
    color: var(--text-dark);
}

.item-info {
    flex: 1;
    overflow: hidden;
}

.item-info h4 {
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 2. Route Finder Panel */
.route-finder-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.route-inputs {
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.route-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.route-point {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.start-point {
    background: var(--color-primary-light);
    box-shadow: 0 0 8px var(--color-primary-light);
}

.end-point {
    background: var(--color-accent);
    box-shadow: 0 0 8px var(--color-accent);
}

.select-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.select-wrapper label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.route-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.88rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.route-select:focus {
    border-color: var(--color-accent);
}

.route-divider-line {
    position: relative;
    height: 1px;
    background: var(--border-glass);
    margin: 4px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.swap-btn {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.swap-btn:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
    transform: rotate(180deg);
}

.swap-btn i {
    width: 14px;
    height: 14px;
}

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

.primary-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    padding: 12px 20px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-glow);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.primary-btn:active {
    transform: translateY(1px);
}

.secondary-btn {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 10px;
    color: #f87171;
    padding: 12px 16px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.secondary-btn:hover {
    background: rgba(220, 38, 38, 0.25);
    color: #ef4444;
}

/* Route Results Card */
.route-results-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.route-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 12px;
}

.route-info-item {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.route-info-item .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.route-info-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent);
}

.route-directions h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.directions-list {
    padding-left: 20px;
    font-size: 0.82rem;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.directions-list li {
    line-height: 1.4;
}

/* 3. Building Details Card (Sidebar Popover) */
.building-details-card {
    margin-top: auto;
    background: linear-gradient(to bottom, rgba(16, 32, 23, 0.95), rgba(8, 16, 12, 0.98));
    border-top: 2px solid var(--color-accent);
    border-bottom: 1px solid var(--border-glass);
    padding: 24px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    z-index: 102;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Scrollable settings to prevent screen overflowing */
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(251, 191, 36, 0.25) transparent;
}

.building-details-card::-webkit-scrollbar {
    width: 6px;
}

.building-details-card::-webkit-scrollbar-thumb {
    background-color: rgba(251, 191, 36, 0.25);
    border-radius: 3px;
}

.details-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.building-badge {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.close-card-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.close-card-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.details-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.num-prefix {
    background: var(--color-accent);
    color: var(--text-dark);
    font-size: 0.82rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
    vertical-align: middle;
    margin-top: 2px;
}

.details-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 400;
    font-style: italic;
}

.details-description {
    font-size: 0.85rem;
    color: #d1d5db;
    line-height: 1.5;
    margin-bottom: 18px;
}

.details-actions {
    display: flex;
}

/* 4. Developer Tools Section */
.dev-settings-panel {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--border-glass);
    padding: 14px 20px;
}

.dev-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dev-header span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dev-body {
    padding-top: 10px;
    animation: fadeIn 0.2s ease;
}

.dev-instructions {
    font-size: 0.72rem;
    color: var(--color-accent);
    margin-bottom: 10px;
    line-height: 1.3;
}

.dev-buttons {
    display: flex;
    gap: 8px;
}

.dev-btn {
    flex: 1;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: var(--font-main);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: var(--transition-smooth);
}

.dev-btn.save {
    background: var(--color-primary);
    color: var(--text-primary);
}

.dev-btn.save:hover {
    background: var(--color-primary-light);
}

.dev-btn.reset {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    border: 1px solid var(--border-glass);
}

.dev-btn.reset:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* Switch Toggle Slider */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border: 1px solid var(--border-glass);
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
}

input:checked + .slider {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: var(--color-primary-light);
}

input:checked + .slider:before {
    transform: translateX(18px);
    background-color: var(--color-primary-light);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* 5. Main Map Viewport */
.map-viewport {
    flex: 1;
    height: 100%;
    position: relative;
    background-color: #0c120e;
    overflow: hidden;
}

.map-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #070d0a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 105;
    transition: opacity 0.5s ease-out;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(16, 185, 129, 0.1);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.map-panzoom-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    cursor: grab;
    user-select: none;
    overflow: hidden;
}

.map-panzoom-container:active {
    cursor: grabbing;
}

/* Map Wrapper: Holds Map Image + Overlays */
.map-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0; /* Important for clean JS scaling */
    will-change: transform;
    display: inline-block;
}

.map-image {
    display: block;
    max-width: none;
    height: auto;
    pointer-events: none;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    border-radius: 4px;
}

/* SVG Overlay Layer */
.map-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Markers Layer */
.map-markers-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Interactive Pins Styling */
.map-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 15;
}

/* Inner pin circle shape */
.pin-circle {
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    border: 2px solid var(--text-primary);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    position: relative;
    z-index: 2;
    transition: var(--transition-smooth);
}

/* Pin tooltip shown on hover */
.pin-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: var(--transition-smooth);
    z-index: 20;
}

.pin-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
}

/* Pin Hover State */
.map-pin:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 30;
}

.map-pin:hover .pin-circle {
    background: var(--color-primary-light);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-glow);
}

.map-pin:hover .pin-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Pin Selected / Active State */
.map-pin.selected {
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 35;
}

.map-pin.selected .pin-circle {
    background: #ef4444 !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.65) !important;
}

/* Pulsing radar ring effect behind the active pin */
.map-pin.selected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ef4444;
    animation: pulseGlow 1.5s infinite ease-out;
    pointer-events: none;
    z-index: 1;
}

@keyframes pulseGlow {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

/* Developer Drag Pin State */
.map-pin.draggable {
    cursor: grab;
}

.map-pin.draggable:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.25);
}

.map-pin.draggable .pin-circle {
    border-style: dashed;
}

/* Custom Marker Pin Variations by Category */
.map-pin.category-dormitory .pin-circle { background: #3b82f6; } /* Blue */
.map-pin.category-facility .pin-circle { background: #8b5cf6; } /* Purple */
.map-pin.category-service .pin-circle { background: #f97316; } /* Orange */
.map-pin.category-office .pin-circle { background: #06b6d4; } /* Cyan */
.map-pin.category-gate .pin-circle { background: #ef4444; } /* Red */
.map-pin.category-other .pin-circle { background: #6b7280; } /* Grey */

/* Zoom / Navigation Controls Floating Layer */
.floating-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
}

.zoom-controls {
    display: flex;
    flex-direction: column;
    background: rgba(13, 22, 17, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.control-btn {
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.control-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-accent);
}

.zoom-controls .control-btn:not(:last-child) {
    border-bottom: 1px solid var(--border-glass);
}

.mobile-menu-btn {
    display: none;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

/* Developer Road Node Graph Layout (Dev Mode) */
.dev-road-node {
    cursor: pointer;
    pointer-events: auto;
    transition: var(--transition-smooth);
}

.dev-road-node:hover {
    fill: var(--color-accent) !important;
    r: 8px !important;
}

.dev-road-edge {
    stroke-dasharray: 4,4;
    transition: var(--transition-smooth);
}

/* SVG Active Route Lines */
.route-path-line {
    fill: none;
    stroke: url(#routeGradient);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 10, 15;
    animation: routeFlow 25s linear infinite;
}

.route-path-line-glow {
    fill: none;
    stroke: var(--color-primary-light);
    stroke-width: 14;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.25;
    filter: url(#glowEffect);
}

@keyframes routeFlow {
    to {
        stroke-dashoffset: -500;
    }
}

/* Floating Tooltip Indicator */
.coord-tooltip {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-glass);
    color: var(--color-accent);
    font-family: monospace;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* ==========================================================================
   Responsive Media Queries (Mobile & Tablet Layout)
   ========================================================================== */
@media (max-width: 900px) {
    .app-container {
        position: relative;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
    }

    .map-viewport {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: calc(55vh - (var(--scroll-pct, 0) * 37vh)) !important; /* Collapses height from 55vh to 18vh */
        transform: scale(calc(1 - (var(--scroll-pct, 0) * 0.35))) !important; /* Scales map down smoothly */
        transform-origin: center top;
        z-index: 1;
        transition: height 0.08s ease-out, transform 0.08s ease-out;
        background-color: #070d0a !important;
    }

    .map-image {
        image-rendering: -webkit-optimize-contrast !important; /* Prevent blurriness on mobile browsers */
        image-rendering: crisp-edges !important;
        image-rendering: auto !important;
    }

    .sidebar {
        position: fixed !important;
        bottom: 0 !important;
        top: auto !important;
        left: 0 !important;
        width: 100% !important;
        height: 82vh !important; /* Fixed height, translated down on load by JS */
        background: transparent !important;
        border-right: none !important;
        border-top: none !important;
        z-index: 10;
        display: flex !important; /* Stack children vertically */
        flex-direction: column !important;
        overflow: visible !important; /* Allow details card to pop over */
        pointer-events: auto !important; /* Receive pointer events normally on iOS */
        scrollbar-width: none;
        will-change: transform;
    }

    .sidebar::-webkit-scrollbar {
        display: none; /* Hide scrollbar on Chrome/Safari */
    }

    /* Force children of sidebar to be interactive and opaque */
    .sidebar-header,
    .tabs-nav,
    .tab-content-container,
    .dev-settings-panel {
        pointer-events: auto;
        background: var(--bg-sidebar) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .sidebar-header {
        position: relative !important;
        z-index: 25;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        border-top: 1px solid var(--border-glass);
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
        padding: 20px 24px;
        cursor: grab;
        touch-action: none; /* Prevent browser scrolling while dragging the header */
    }

    /* Grabber handle bar at the top of the sliding drawer */
    .sidebar-header::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
        margin: -8px auto 12px auto;
    }

    .tabs-nav {
        position: relative !important;
        z-index: 24;
        border-bottom: 1px solid var(--border-glass);
        box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    }

    .tab-content-container {
        display: block !important;
        overflow-y: auto !important; /* Enable internal scrolling on mobile */
        -webkit-overflow-scrolling: touch !important; /* Kinetic inertia scroll on iOS Safari */
        background: var(--bg-sidebar);
        flex: 1 !important; /* Take remaining space */
        padding-bottom: 80px; /* Add extra breathing room at the bottom */
    }

    /* Disable collapsed states on mobile */
    .sidebar.collapsed {
        height: 82vh !important;
    }

    /* Floating controls relative position for mobile overlay */
    .floating-controls {
        position: fixed;
        bottom: 24px;
        right: 24px;
        z-index: 5; /* Sit between map (1) and sidebar drawer (10) so it scrolls behind it */
        pointer-events: auto;
    }
    
    .mobile-menu-btn {
        display: none !important; /* Hide collapse toggle button as the drawer is now drag-based */
    }

    /* Mobile details card */
    .building-details-card {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 20px 20px 0 0;
        z-index: 120;
        max-height: 80vh;
        overflow-y: auto;
        pointer-events: auto;
    }
}

/* Department tag badges in details card */
.dept-tag {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--color-primary-light);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.dept-tag:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.35);
    color: var(--color-accent);
    transform: translateY(-1px);
}

.dept-tag.highlight {
    background: rgba(251, 191, 36, 0.12) !important;
    border-color: rgba(251, 191, 36, 0.45) !important;
    color: var(--color-accent) !important;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
}

@keyframes cardPulseGlow {
    0% {
        box-shadow: 0 0 5px rgba(251, 191, 36, 0.15);
    }
    50% {
        box-shadow: 0 0 15px rgba(251, 191, 36, 0.35);
    }
    100% {
        box-shadow: 0 0 5px rgba(251, 191, 36, 0.15);
    }
}



