/* --- 1. RESET & VARS --- */
:root {
    --primary: #00b894; --primary-dark: #00a884;
    --accent: #0984e3; --danger: #d63031;
    --dark: #2d3436; --grey: #636e72;
    --glass: rgba(255, 255, 255, 0.95);
    --shadow: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
body { 
    font-family: 'Plus Jakarta Sans', sans-serif; margin: 0; padding: 0; 
    overflow: hidden; height: 100dvh; width: 100vw; 
    background: #dfe6e9; color: var(--dark);
}

/* --- 2. MAP LAYER --- */
.app-container { width: 100%; height: 100%; position: relative; }
#map { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }

/* --- 3. UI SEARCH (DEFAULT MOBILE) --- */
.ui-top {
    position: absolute; top: 0; left: 0; width: 100%;
    padding: 15px; z-index: 100; pointer-events: none;
    display: flex; flex-direction: column; gap: 10px;
}
.ui-top > * { pointer-events: auto; }

.glass-card {
    background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 10px; border: 1px solid rgba(255,255,255,0.8);
}

.nav-row { display: flex; gap: 8px; align-items: center; }
.nav-input { flex: 1; padding: 12px; border: none; background: #f1f2f6; border-radius: 12px; font-size: 0.95rem; }
.btn-icon { width: 44px; height: 44px; border: none; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; transition: 0.2s; }
.btn-icon:active { transform: scale(0.95); }
.btn-go { background: #f1c40f; color: var(--dark); font-weight: 800; }
.btn-menu { background: var(--dark); color: white; }

.input-row { position: relative; margin-bottom: 8px; display: flex; align-items: center; }
.input-row:last-child { margin-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; position: absolute; left: 12px; z-index: 2; }
.dot-blue { background: var(--accent); box-shadow: 0 0 0 2px white; }
.dot-red { background: var(--danger); box-shadow: 0 0 0 2px white; }

.modern-input { width: 100%; padding: 14px 85px 14px 35px; border: 1px solid #e0e0e0; border-radius: 12px; font-size: 0.9rem; background: white; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; transition: 0.2s; }
.modern-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1); }
.input-actions { position: absolute; right: 5px; display: flex; gap: 2px; }
.btn-mini { width: 34px; height: 34px; background: #f8f9fa; border: 1px solid #eee; border-radius: 10px; cursor: pointer; color: var(--grey); display: flex; align-items: center; justify-content: center; }

/* --- 4. FORM ORDER (MOBILE SHEET) --- */
.sheet-wrapper {
    position: absolute; bottom: 0; left: 0; width: 100%;
    z-index: 500; pointer-events: none;
    display: flex; flex-direction: column; justify-content: flex-end;
}

.sheet {
    pointer-events: auto; background: white;
    border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    display: flex; flex-direction: column;
    width: 100%; height: 300px; 
    transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    max-width: 500px; margin: 0 auto;
}
.sheet.expanded { height: 85vh; }

.sheet-handle {
    width: 100%; padding: 12px 0; cursor: pointer; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center;
    border-bottom: 1px solid #f0f0f0; background: white; border-radius: 24px 24px 0 0;
}
.bar { width: 40px; height: 5px; background: #dfe6e9; border-radius: 10px; margin-bottom: 5px; }
.handle-text { font-size: 0.7rem; color: var(--grey); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.sheet-content {
    flex: 1; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 15px; scrollbar-width: none;
}

.sheet-footer {
    flex-shrink: 0; padding: 15px 20px 25px 20px;
    background: white; border-top: 1px solid #f1f2f6;
    padding-bottom: calc(25px + env(safe-area-inset-bottom));
}

/* --- 5. COMPONENTS --- */
.section-title { font-size: 0.75rem; font-weight: 800; color: var(--primary); text-transform: uppercase; margin-bottom: 5px; letter-spacing: 0.5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.std-input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 12px; background: #f9f9f9; font-size: 0.9rem; margin-bottom: 5px; transition: 0.2s; }
.std-input:focus { background: white; border-color: var(--primary); }

.info-card { background: #f8f9fa; padding: 12px; border-radius: 12px; border: 1px solid #eee; display: flex; flex-direction: column; }
.info-lbl { font-size: 0.7rem; color: var(--grey); margin-bottom: 4px; font-weight: 600; }
.input-clean { border: none; background: transparent; font-weight: 700; width: 100%; font-size: 0.95rem; padding: 0; color: var(--dark); }

.btn-booking { width: 100%; padding: 14px; background: #e0f7fa; color: var(--accent); border: 1px dashed var(--accent); border-radius: 12px; font-weight: 700; cursor: pointer; text-align: center; margin-top: 5px; transition:0.2s; }
.btn-booking:hover { background: #b2ebf2; }

.link-group { display: flex; justify-content: center; gap: 25px; margin-top: 15px; }
.text-link { font-size: 0.85rem; color: var(--grey); text-decoration: none; cursor: pointer; font-weight: 600; transition:0.2s; }
.text-link:hover { color: var(--primary); }

.price-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.price-val { font-size: 1.6rem; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }

.btn-main { width: 100%; padding: 16px; border: none; border-radius: 14px; background: linear-gradient(135deg, #00b894, #00a884); color: white; font-weight: 700; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 8px 20px rgba(0, 184, 148, 0.3); transition: 0.2s; }
.btn-main:active { transform: scale(0.98); box-shadow: 0 4px 10px rgba(0, 184, 148, 0.2); }
.btn-main:disabled { background: #ccc; box-shadow: none; cursor: not-allowed; }
.btn-reset { text-align: center; margin-top: 12px; font-size: 0.8rem; color: var(--grey); text-decoration: underline; cursor: pointer; }

.float-wrap { position: absolute; right: 15px; bottom: 320px; display: flex; flex-direction: column; gap: 10px; z-index: 200; pointer-events: auto; transition: bottom 0.3s; }
.btn-circle { width: 48px; height: 48px; background: white; border-radius: 14px; border: none; box-shadow: 0 8px 20px rgba(0,0,0,0.1); font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--dark); transition: 0.2s; }
.btn-circle:active { transform: scale(0.9); }

/* MODALS */
.modal-wrap { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-wrap.active { display: flex; animation: fadeIn 0.2s; }
.modal-box { background: white; width: 85%; max-width: 380px; padding: 30px; border-radius: 24px; text-align: center; position: relative; animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-box.fullscreen { width: 100%; height: 100%; max-width: none; border-radius: 0; padding: 0; display: flex; flex-direction: column; animation: slideUp 0.3s; }
.modal-header-full { padding: 15px 20px; background: var(--primary); color: white; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 1.1rem; }
.btn-close { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; background: none; border: none; cursor: pointer; color: #b2bec3; transition: 0.2s; }
.btn-close:hover { color: var(--danger); }
.btn-close-full { background: none; border: none; font-size: 2rem; color: white; cursor: pointer; line-height: 1; }

.nice-select-wrap { position: relative; margin-bottom: 15px; text-align: left; }
.nice-select { width: 100%; padding: 14px 40px 14px 45px; font-size: 0.95rem; background: #f8f9fa; border: 1px solid #dfe6e9; border-radius: 12px; appearance: none; outline: none; cursor: pointer; font-family: inherit; color: var(--dark); transition:0.2s; }
.nice-select:focus { border-color: var(--primary); background: white; }
.nice-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--primary); pointer-events: none; font-size: 1.1rem; }
.nice-arrow { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: #aaa; pointer-events: none; font-size: 0.8rem; }

/* SIDEBAR */
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 800; display: none; backdrop-filter: blur(3px); }
.sidebar-overlay.active { display: block; }
.sidebar { position: fixed; top: 0; right: -320px; width: 85%; max-width: 320px; height: 100%; background: white; z-index: 801; box-shadow: -5px 0 30px rgba(0,0,0,0.15); transition: right 0.3s cubic-bezier(0.25, 1, 0.5, 1); display: flex; flex-direction: column; }
.sidebar.active { right: 0; }
.sidebar-header { padding: 25px; background: var(--primary); color: white; display: flex; justify-content: space-between; align-items: center; }
.sidebar-body { flex: 1; overflow-y: auto; padding: 20px; background: #f8f9fa; }
.menu-item { background: white; border-radius: 12px; padding: 16px; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,0.03); cursor: pointer; border: 1px solid #eee; margin-bottom: 12px; font-weight: 600; color: var(--dark); transition:0.2s; }
.menu-item:active { transform: scale(0.98); }

/* SUGGESTIONS */
.suggestions { position: absolute; top: 100%; left: 0; right: 0; background: white; border-radius: 0 0 12px 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); max-height: 250px; overflow-y: auto; z-index: 200; }
.suggestion-item { padding: 14px 15px; border-bottom: 1px solid #f5f5f5; font-size: 0.9rem; cursor: pointer; display:flex; align-items:center; gap:10px; transition:0.1s; }
.suggestion-item:hover { background: #f8f9fa; }
.suggestion-item::before { content:'📍'; font-size:1rem; }

/* HISTORY LIST */
.history-list { flex: 1; overflow-y: auto; padding: 20px; background: #f8f9fa; text-align: left; }
.history-item { background: white; padding: 15px; margin-bottom: 15px; border-radius: 12px; border-left: 5px solid var(--primary); box-shadow: 0 4px 10px rgba(0,0,0,0.03); position:relative; }
.h-date { font-size: 0.8rem; color: #888; display:flex; justify-content:space-between; margin-bottom:8px; border-bottom:1px solid #f0f0f0; padding-bottom:5px; }
.h-price { font-weight:800; color:var(--primary); font-size:1rem; }
.h-route { font-weight:700; color:var(--dark); margin-bottom:5px; font-size:0.95rem; line-height:1.4; }
.h-info { font-size:0.85rem; color:#666; background:#f9f9f9; padding:5px 10px; border-radius:5px; display:inline-block; }
.h-btn { display:block; text-align:center; margin-top:12px; padding:8px; background:#e0f2f1; color:var(--primary-dark); border-radius:8px; text-decoration:none; font-size:0.85rem; font-weight:bold; }

/* ANIMATIONS */
@keyframes popUp { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 6. DESKTOP TWEAKS (PC) --- */
@media (min-width: 768px) {
    .ui-top { max-width: 380px; margin-left: 40px; margin-top: 40px; z-index: 600; }
    .sheet-wrapper { 
        width: 400px; left: auto !important; right: 40px !important; bottom: 40px !important; top: auto !important;
        height: auto; z-index: 600; pointer-events: none;
    }
    .sheet { 
        pointer-events: auto; border-radius: 20px 20px 0 0; height: 160px !important; /* Minimize */
        overflow: hidden; transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        box-shadow: 0 10px 40px rgba(0,0,0,0.15); margin: 0; border: 1px solid #eee;
    }
    .sheet.expanded { height: 85vh !important; }
    .sheet-handle { display: flex !important; cursor: pointer; background: #fafafa; }
    .sheet-handle:hover { background: #f0f0f0; }
    .float-wrap { bottom: 50px; left: 50px; right: auto !important; flex-direction: row; gap: 15px; }
}

/* --- 7. STYLE POPUP DRIVER (PREMIUM GLASSMORPHISM) --- */

/* 1. Override Kotak Bawaan Leaflet */
.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.9) !important; /* Putih Transparan */
    backdrop-filter: blur(15px) !important;           /* Efek Blur Kaca */
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
    padding: 0 !important;
    overflow: visible !important; /* PENTING: Agar foto bisa 'nongol' keluar */
    width: 260px !important;
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.9) !important; 
}

.leaflet-popup-content { margin: 0 !important; width: 100% !important; }

/* 2. Container Isi Popup */
.driver-popup {
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-align: center;
    padding: 50px 20px 20px 20px; /* Padding atas besar utk tempat foto */
    position: relative;
    border-radius: 24px;
}

/* 3. Foto Driver (Floating / Menonjol ke Atas) */
.dp-photo-wrap {
    width: 85px !important;
    height: 85px !important;
    position: absolute;
    top: -40px; /* Tarik ke atas agar keluar dari kotak */
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50% !important;
    padding: 4px;
    background: white;
    box-shadow: 0 10px 20px rgba(0, 184, 148, 0.3); /* Bayangan hijau halus */
    z-index: 10;
}

.dp-photo {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    border: 3px solid #00b894; /* Ring Hijau Premium */
    display: block;
}

/* 4. Typography & Layout */
.dp-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #2d3436;
    margin-bottom: 5px;
    margin-top: 5px;
    letter-spacing: -0.5px;
}

.dp-car {
    display: inline-block;
    background: linear-gradient(135deg, #0984e3, #74b9ff);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(9, 132, 227, 0.3);
}

.dp-stars {
    color: #f1c40f;
    font-size: 1.1rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 2px rgba(241, 196, 15, 0.3));
    letter-spacing: 2px;
}

/* 5. Footer Update Lokasi */
.dp-update {
    font-size: 0.75rem;
    color: #636e72;
    border-top: 1px dashed rgba(0,0,0,0.1);
    padding-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
}

/* Animasi Bintang */
.star-anim { display: inline-block; opacity: 0; animation: starPop 0.4s ease forwards; }
.star-anim:nth-child(1) { animation-delay: 0.1s; }
.star-anim:nth-child(2) { animation-delay: 0.2s; }
.star-anim:nth-child(3) { animation-delay: 0.3s; }
.star-anim:nth-child(4) { animation-delay: 0.4s; }
.star-anim:nth-child(5) { animation-delay: 0.5s; }

@keyframes starPop {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.4); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Tombol Tutup Default Leaflet dipercantik */
.leaflet-popup-close-button {
    color: #b2bec3 !important;
    font-size: 1.2rem !important;
    top: 10px !important;
    right: 10px !important;
    transition: 0.3s;
}
.leaflet-popup-close-button:hover { color: #d63031 !important; }