/* src/lib/styles/maps.css */

/* --- 1. RESET & BASIC LAYOUT --- */
:global(body) {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "Poppins", sans-serif;
    background-color: #f0f0f0;
}

.map-container {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background-color: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.map {
    width: 100%;
    height: 100%;
    z-index: 0;
    outline: none;
}

.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* --- 2. BUTTONS & FLOATING ACTION --- */
.floating-action-buttons {
    position: absolute;
    bottom: 30px;
    left: 30px;
    display: flex;
    gap: 15px;
    pointer-events: auto;
    z-index: 100;
    width: max-content;
}

.btn-action {
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.btn-action:hover {
    transform: translateY(-3px);
}

.btn-blue-big {
    background-color: #c5a038;
}

.btn-green-big {
    background-color: #4caf50;
}

/* --- 3. SEARCH CARD & LOADING KECIL --- */
.search-card-container {
    position: absolute;
    bottom: 40px;
    left: 20px;
    width: 350px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    padding: 20px;
    pointer-events: auto;
}

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

.btn-close-custom {
    background: none;
    border: none;
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

/* HASIL SEARCH DROPDOWN */
.search-results-dropdown {
    position: absolute;
    bottom: 100%;
    top: auto;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1050;
    margin-bottom: 5px;
}

.search-item {
padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: flex-start; /* Icon tetep di atas pas teks turun */
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
    background: white;
    pointer-events: auto;
    
    /* LOGIKA WRAPPING: */
    white-space: normal; /* Izinkan teks turun baris */
    height: auto;        /* Tinggi nyesuain isi teks */
    line-height: 1.4;    /* Jarak antar baris biar enak dibaca */
    color: #333;
}

.search-item:hover {
    background-color: #f5f5f5;
    color: #c5a038;
}

/* LOADING TEXT DI BAWAH INPUT (STYLE BARU) */
.search-loading-indicator {
    /* Kita bikin dia diem di tempat (bukan melayang) biar kartunya ngikutin */
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;
    /* Teks di tengah biar cakep */
    gap: 10px;

    background: #fff8e1;
    /* Kuning muda banget (khas B-Erl) biar highlight */
    color: #c5a038;
    /* Teks warna Emas */

    padding: 10px;
    margin-top: 10px;
    /* Jarak dari input di atasnya */
    margin-bottom: 5px;
    /* Jarak ke tombol di bawahnya */

    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #ffe082;

    /* Animasi muncul pelan biar smooth */
    animation: fadeIn 0.3s ease-in-out;
}

/* Spinner Kecil buat di Search */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spinner-mini {
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #C5A038;
    /* Warna Emas */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}


.btn-gold {
    background-color: #c5a038;
    color: white;
}

.btn-green-map {
    background-color: #4caf50;
    color: white;
}

/* --- 4. MODAL LIST & GRID --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 2000;
    backdrop-filter: blur(3px);
}

.modal-list-container {
    width: 90%;
    max-width: 800px;
    height: 85vh;
    background-color: white;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-header-custom {
    padding: 25px;
    background-color: white;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.brand-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.brand-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
}

.search-bar-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

.list-search-input {
    width: 100%;
    padding: 12px 12px 12px 45px;
    border-radius: 50px;
    border: 1px solid #ccc;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
}

.list-search-input:focus {
    border-color: #c5a038;
    box-shadow: 0 0 0 3px rgba(197, 160, 56, 0.1);
}

.store-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    background-color: #f8f9fa;
    align-content: start;
}

.store-card {
    background: white;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 15px;
    transition: transform 0.2s;
    height: fit-content;
}

.store-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-image-wrapper {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
}

.store-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10%;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.store-badges {
    margin-bottom: 5px;
}

.badge-level {
    background-color: #fff8e1;
    color: #c5a038;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid #ffe082;
}

.card-content h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    color: #333;
    font-weight: 700;
    line-height: 1.2;
}

.store-address {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #777;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-chat, .btn-visit-gold {
    flex: 1;
    padding: 8px;
    height: 36px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 36px;
    white-space: nowrap;
}

.btn-chat {
    background-color: #25d366;
}

.btn-visit-gold {
    background-color: #cdad5c;
}

.btn-visit-gold:hover {
    background-color: #b89a4b;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: #aaa;
    margin-top: 50px;
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 10px;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    text-align: center;
    background: white;
}

.btn-close-modal-black {
    background-color: #222;
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-close-modal-black:hover {
    background-color: #000;
}

/* --- 5. CLUSTER WARNA (FINAL) --- */
:global(.marker-cluster) {
    background-clip: padding-box;
    border-radius: 50%;
    border: 4px solid rgba(0, 0, 0, 0.15);
}

:global(.marker-cluster div) {
    width: 30px;
    height: 30px;
    margin: 5px;
    border-radius: 50%;
    text-align: center;
    font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* 1. KECIL (Zoom In) -> KUNING */
:global(.marker-cluster-small) {
    background-color: rgba(241, 211, 87, 0.4);
    border: 3px solid #fbc02d;
}

/* 2. SEDANG (Zoom Out) -> MERAH */
:global(.marker-cluster-medium) {
    background-color: rgba(255, 100, 100, 0.4);
    border: 3px solid #e53935;
}

/* 3. BESAR -> MERAH TUA */
:global(.marker-cluster-large) {
    background-color: rgba(200, 50, 50, 0.4);
    border: 3px solid #8b0000;
}

/* --- 6. LOADING SPINNER (FULL SCREEN) --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #c5a038;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* =========================================
   7. MOBILE RESPONSIVE (TAMBAHAN)
   ========================================= */

@media (max-width: 768px) {


    :global(.leaflet-bottom.leaflet-right) {
        bottom: 960px !important; /* Dorong ke atas biar gak ketimpa tombol list */
        right: 15px !important;   /* Jaga jarak dari kanan dikit */
        display: flex;
        flex-direction: column;
        z-index: 900 !important;
        right: 10px !important;
    }

    /* 1. Tombol Melayang (Pindah ke Tengah Bawah) */
    .floating-action-buttons {
        left: 20px;
        bottom: 40px;
        transform: none;
        width: auto;
        justify-content: flex-start;
        gap: 10px;
        z-index: 1000;
    }

    .btn-action {
        padding: 8px 20px;
        font-size: 14px;
        gap: 5px;
        height: 38px;
    }

    .map-container {
        bottom: 15px;
    }
        /* 2. Search Card (Jadi Bottom Sheet / Nempel Bawah) */
        .search-card-container {
            width: 100%;
            left: 0;
            bottom: 0;
            border-radius: 20px 20px 0 0;
            padding: 20px;
            box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
            box-sizing: border-box;
            max-width: 100vh;
            overflow: visible !important;
            z-index: 20000;
        }

        /* Input text di HP biar enak diteken */
        .form-control {
            height: 45px;
            font-size: 16px;
        }

        /* 3. Modal List (Jadi Full Screen) */
        .modal-list-container {
            width: 100%;
            height: 100%;
            /* Menuhin Layar */
            max-width: 100%;
            border-radius: 0;
            /* Gak usah melengkung */
        }

        .modal-header-custom {
            padding: 15px;
            /* Ratin dikit space-nya */
        }

        /* Grid Toko di HP (1 Kolom aja biar jelas) */
        .store-grid {
            grid-template-columns: 1fr;
            /* 1 Toko per baris */
            padding: 15px;
        }

        /* Loading Overlay (Spinner) */
        .loading-overlay {
            backdrop-filter: blur(5px);
            /* Blur lebih kuat di HP biar fokus */
        }

        /* Dropdown Hasil Search (Biar gak kepotong keyboard) */
        .search-results-dropdown {
            width: 100%;
            box-sizing: border-box;
            max-height: 200px;
        }
    }

    .card-toko {
        width: 260px;
        font-family: sans-serif;
    }

    .toko-header {
        display: flex;
        gap: 10px;
        align-items: flex-start;
    }

    .toko-img {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        object-fit: cover;
    }

    .toko-info {
        flex: 1;
    }

    .toko-title {
        margin: 0;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.3;
    }

    .toko-meta {
        margin-top: 4px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .toko-badge {
        font-size: 10px;
        padding: 3px 6px;
        border-radius: 4px;
        color: #fff;
    }

    .toko-badge.real {
        background: #2196F3;
    }

    .toko-badge.estimasi {
        background: #C5A038;
    }

    .toko-jarak {
        font-size: 11px;
        color: #666;
    }

    .divider {
        margin: 10px 0;
    }

    .btn-toko {
        width: 100%;
        border: none;
        padding: 7px 10px;
        font-size: 12px;
        border-radius: 6px;
        cursor: pointer;
        margin-bottom: 6px;
        transition: 0.2s ease;
    }

    .btn-wa {
        background: #25D366;
        color: #fff;
    }

    .btn-wa:hover {
        background: #1ebe5d;
    }

    .btn-view {
        background: #0d6efd;
        color: #fff;
    }

    .btn-view:hover {
        background: #0b5ed7;
    }
}