:root {
    --bg-color: #ffffff;
    --text-main: #1f2937;
    --text-sub: #6b7280;
    --sheet-bg: rgba(255, 255, 255, 0.95);
    --accent: #BF1E2E;
    --shadow: 0 4px 20px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; font-family: 'Segoe UI', sans-serif; }
body { overflow: hidden; background: var(--bg-color); height: 100vh; width: 100vw; }

#map { height: 100dvh; width: 100%; }

/* Hapus logo Mapbox agar bersih */
.mapboxgl-ctrl-logo, .mapboxgl-ctrl-attrib { display: none !important; }

/* FLOATING CONTROLS */
.floating-controls {
    position: absolute; top: 50px; right: 15px;
    display: flex; flex-direction: column; gap: 15px;
    z-index: 10;
}

.fab-btn {
    width: 48px; height: 48px; border-radius: 50%; border: none;
    background: var(--sheet-bg); color: var(--text-main);
    box-shadow: var(--shadow); font-size: 1.2rem; cursor: pointer;
    backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}
.fab-btn:active { transform: scale(0.95); }

/* GAYA TOMBOL LIVE CAM */
.main-fab {
    width: 56px; height: 56px;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.main-fab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 20px rgba(191, 30, 46, 0.6);
    animation: pulse-border 2s infinite;
}

/* Label 2D/3D kecil */
.btn-label {
    position: absolute; bottom: -6px; right: -6px;
    background: #333; color: white;
    font-size: 0.6rem; font-weight: bold;
    padding: 2px 6px; border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(191, 30, 46, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(191, 30, 46, 0); }
    100% { box-shadow: 0 0 0 0 rgba(191, 30, 46, 0); }
}

/* BOTTOM SHEET */
.bottom-sheet {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: var(--sheet-bg); border-radius: 24px 24px 0 0;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.1); z-index: 11;
    backdrop-filter: blur(15px); transition: transform 0.3s ease;
    max-height: 60vh; display: flex; flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

.sheet-handle-bar { width: 100%; height: 24px; display: flex; align-items: center; justify-content: center; }
.sheet-handle { width: 40px; height: 5px; background: #d1d5db; border-radius: 10px; }
.sheet-header { padding: 0 20px 10px 20px; }
.header-text h1 { font-size: 1.4rem; color: var(--text-main); display: flex; align-items: center; gap: 8px; margin: 0; }

.live-badge {
    font-size: 0.7rem; background: #ef4444; color: white;
    padding: 2px 8px; border-radius: 12px; animation: pulse 2s infinite;
}
.eta-badge { margin-top: 5px; font-size: 0.9rem; font-weight: 600; color: #10b981; }
.eta-badge.hidden { display: none; }

.scroll-legend {
    display: flex; gap: 10px; padding: 0 20px 15px 20px;
    overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.chip {
    font-size: 0.85rem; padding: 6px 12px; border-radius: 20px; color: white;
    display: flex; align-items: center; gap: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.morning { background: #BF1E2E; }
.afternoon { background: #159BB3; }

.sheet-content { padding: 0 20px 30px 20px; overflow-y: auto; flex-grow: 1; }
.sheet-content h3 { font-size: 0.85rem; color: var(--text-sub); text-transform: uppercase; margin-bottom: 10px; }

.bus-item {
    display: flex; align-items: center; background: rgba(0,0,0,0.03);
    padding: 12px; border-radius: 16px; margin-bottom: 10px;
    border: 1px solid transparent; transition: 0.2s; cursor: pointer;
}
.bus-item.active-focus { border-color: var(--accent); background: rgba(191, 30, 46, 0.08); }

.bus-icon-wrapper {
    width: 45px; height: 45px; background: white; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; margin-right: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.bus-icon-wrapper img { width: 32px; height: 32px; object-fit: contain; }

.bus-info h4 { font-size: 1rem; margin-bottom: 4px; color: var(--text-main); }
.bus-info p { font-size: 0.8rem; color: var(--text-sub); margin: 0; }

/* Status Dot */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot-green { background: #10b981; box-shadow: 0 0 5px #10b981; }
.dot-red { background: #ef4444; box-shadow: 0 0 8px #ef4444; animation: blink 1s infinite; }
.dot-gray { background: #9ca3af; }

.empty-state { text-align: center; padding: 30px 20px; color: var(--text-sub); }
.empty-state i { font-size: 2rem; margin-bottom: 10px; opacity: 0.5; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Popup Custom */
.mapboxgl-popup-content {
    border-radius: 12px; padding: 15px; box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    font-family: 'Segoe UI', sans-serif;
}
.iw-header { display: flex; align-items: center; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid #eee; }
.iw-icon { width: 24px; margin-right: 8px; }

@media (min-width: 768px) {
    .bottom-sheet { top: 20px; left: 20px; bottom: auto; right: auto; width: 360px; max-height: 85vh; border-radius: 20px; }
    .sheet-handle-bar { display: none; }
    .sheet-header { padding-top: 20px; }
    .floating-controls { top: 20px; right: 20px; }
}
