@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&display=swap');

/**
 * REI Cabang & Maps Frontend Stylesheet
 * Desain Modern Bernuansa Ungu Brand Raja Emas (#421a40, #70276b) & Aksen Emas (#daa127)
 * Tampilan Grid dengan Peta Google Maps per Cabang (Sesuai UI Website Raja Emas)
 */

:root {
    --rei-primary: #421a40;
    --rei-primary-dark: #2d112c;
    --rei-accent: #70276b;
    --rei-accent-light: #8c3186;
    --rei-gold: #daa127;
    --rei-wa-green: #25D366;
    --rei-wa-hover: #1ebd56;
    --rei-bg: #f8fafc;
    --rei-card-bg: #ffffff;
    --rei-text: #1e293b;
    --rei-text-muted: #64748b;
    --rei-border: #e2e8f0;
    --rei-border-hover: #9c4996;
    --rei-radius: 16px;
    --rei-shadow: 0 4px 20px -2px rgba(66, 26, 64, 0.08);
    --rei-shadow-hover: 0 12px 30px -4px rgba(66, 26, 64, 0.16);
    --rei-font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.rei-locator-wrapper {
    font-family: var(--rei-font) !important;
    color: var(--rei-text) !important;
    width: 100% !important;
    max-width: 1320px !important;
    margin: 0 auto !important;
    padding: 20px 15px 40px !important;
    box-sizing: border-box !important;
    display: block !important;
    clear: both !important;
    text-align: left;
}

.rei-locator-wrapper * {
    box-sizing: border-box !important;
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */
.rei-header-bar {
    margin-bottom: 25px;
    text-align: center;
}

.rei-header-title-wrap {
    max-width: 820px;
    margin: 0 auto;
}

.rei-badge-pill {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(66, 26, 64, 0.08), rgba(218, 161, 39, 0.15));
    color: var(--rei-primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 6px 16px;
    border-radius: 30px;
    margin-bottom: 12px;
    border: 1px solid rgba(66, 26, 64, 0.2);
}

.rei-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--rei-primary);
    margin: 0 0 12px 0;
    line-height: 1.25;
}

.rei-subtitle {
    font-size: 15px;
    color: var(--rei-text-muted);
    margin: 0;
    line-height: 1.6;
}

/* ==========================================================================
   SEARCH & LOCATION TOOLBAR
   ========================================================================== */
.rei-filter-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.rei-search-container {
    position: relative;
    flex: 1 1 300px;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid var(--rei-border);
    border-radius: 12px;
    height: 52px;
    min-height: 52px;
    padding: 0 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.rei-search-container:focus-within {
    border-color: var(--rei-accent);
    box-shadow: 0 0 0 4px rgba(66, 26, 64, 0.12);
}

.rei-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--rei-accent);
    margin-right: 10px;
    pointer-events: none;
}

.rei-search-input {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    font-family: inherit;
    font-size: 15px;
    color: var(--rei-text);
}

.rei-search-input::placeholder {
    color: #94a3b8;
}

.rei-clear-btn {
    flex-shrink: 0;
    background: #e2e8f0;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 0;
    transition: background 0.15s ease;
}

.rei-clear-btn:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.rei-geolocate-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    min-height: 52px;
    padding: 0 22px;
    background: linear-gradient(135deg, var(--rei-primary) 0%, var(--rei-accent) 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(66, 26, 64, 0.25);
    white-space: nowrap;
    flex-shrink: 0;
}

.rei-geolocate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(66, 26, 64, 0.35);
}

/* ==========================================================================
   OPSI DAERAH BERBENTUK BUTTON (FILTER DAERAH / KOTA)
   ========================================================================== */
.rei-daerah-container-wrap {
    background: #ffffff;
    border: 1px solid var(--rei-border);
    border-radius: var(--rei-radius);
    padding: 20px 24px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(66, 26, 64, 0.04);
}

.rei-daerah-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.rei-daerah-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--rei-primary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.rei-toggle-more-btn {
    background: transparent;
    border: none;
    color: var(--rei-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.rei-toggle-more-btn:hover {
    background: rgba(66, 26, 64, 0.08);
}

.rei-daerah-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rei-daerah-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1.5px solid var(--rei-border);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rei-daerah-btn:hover {
    background: #f1f5f9;
    border-color: var(--rei-accent);
    color: var(--rei-primary);
    transform: translateY(-1px);
}

.rei-daerah-btn.active {
    background: linear-gradient(135deg, var(--rei-primary) 0%, var(--rei-accent) 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(66, 26, 64, 0.28);
}

.rei-daerah-btn .rei-count {
    display: inline-block;
    background: rgba(0, 0, 0, 0.07);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
}

.rei-daerah-btn.active .rei-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* ==========================================================================
   RESULTS INFO
   ========================================================================== */
.rei-results-info {
    font-size: 14.5px;
    color: var(--rei-text-muted);
    margin-bottom: 22px;
    font-weight: 500;
    padding-left: 2px;
}

#reiResultCount {
    font-weight: 800;
    color: var(--rei-accent);
}

/* ==========================================================================
   GRID MODEL (TAMPILAN MAPS PER CABANG MIRIP SITUS ASLI)
   ========================================================================== */
.rei-grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    align-items: stretch;
}

.rei-branch-card {
    background: var(--rei-card-bg);
    border: 1px solid var(--rei-border);
    border-radius: var(--rei-radius);
    padding: 22px;
    box-shadow: var(--rei-shadow);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.rei-branch-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--rei-shadow-hover);
    border-color: var(--rei-border-hover);
}

/* 1. Header Informasi Cabang */
.rei-card-info {
    margin-bottom: 16px;
    flex-grow: 1;
}

.rei-card-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--rei-primary);
    margin: 0 0 12px 0;
    line-height: 1.35;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rei-card-number {
    font-size: 22px;
    font-weight: 900;
    color: var(--rei-primary);
    line-height: 1;
}

.rei-card-name {
    color: var(--rei-primary);
}

.rei-card-address {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 14px;
}

.rei-card-address p {
    margin: 0;
}

.rei-card-contact {
    margin-bottom: 12px;
}

.rei-card-wa-link {
    display: inline-block;
    color: #16a34a !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.15s ease;
}

.rei-card-wa-link:hover {
    color: #15803d !important;
    text-decoration: underline;
}

.rei-card-hours {
    font-size: 13.5px;
    color: #334155;
    line-height: 1.5;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--rei-gold);
    margin-bottom: 8px;
}

.rei-hours-text {
    margin: 0 0 3px 0;
}

.rei-notes-text {
    margin: 0;
}

.rei-green-text {
    color: #16a34a;
    font-weight: 700;
}

.rei-distance-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    margin-top: 8px;
}

/* 2. Map Container per Cabang */
.rei-card-map-wrapper {
    width: 100%;
    height: 180px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
}

.rei-card-map-wrapper iframe {
    display: block;
    width: 100%;
    height: 100%;
}

/* 3. Tombol Aksi */
.rei-card-buttons {
    display: flex;
    gap: 8px;
}

.rei-btn-menuju-lokasi {
    flex: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--rei-primary) 0%, var(--rei-accent) 100%);
    color: #ffffff !important;
    text-decoration: none;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(66, 26, 64, 0.22);
}

.rei-btn-menuju-lokasi:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(66, 26, 64, 0.32);
}

.rei-btn-chat-wa {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--rei-wa-green);
    color: #ffffff !important;
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.25);
}

.rei-btn-chat-wa:hover {
    background: var(--rei-wa-hover);
    transform: translateY(-1px);
}

.rei-btn-icon-svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Empty State */
.rei-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: var(--rei-radius);
    border: 1px dashed var(--rei-border);
}

.rei-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.rei-empty-state h3 {
    margin: 0 0 8px 0;
    color: var(--rei-primary);
    font-size: 20px;
}

.rei-empty-state p {
    color: var(--rei-text-muted);
    margin: 0 0 18px 0;
}

.rei-btn-reset {
    background: var(--rei-accent);
    color: #ffffff;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.rei-btn-reset:hover {
    opacity: 0.9;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media screen and (max-width: 1080px) {
    .rei-grid-layout {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media screen and (max-width: 768px) {
    .rei-locator-wrapper {
        padding: 10px 10px 30px !important;
    }

    .rei-title {
        font-size: 24px !important;
        line-height: 1.3 !important;
    }

    .rei-subtitle {
        font-size: 14px !important;
    }

    /* Toolbar Search & Geolocate: rapi, tidak meregang vertikal */
    .rei-filter-wrapper {
        flex-direction: column !important;
        gap: 10px !important;
        margin-bottom: 18px !important;
        width: 100% !important;
    }

    .rei-search-container {
        flex: 0 0 52px !important;
        width: 100% !important;
        height: 52px !important;
        min-height: 52px !important;
    }

    .rei-geolocate-btn {
        width: 100% !important;
        height: 48px !important;
        min-height: 48px !important;
        justify-content: center !important;
    }

    /* ==========================================================================
       OPSI DAERAH / KOTA BERBENTUK SCROLL HORIZONTAL PADA MOBILE VIEW
       ========================================================================== */
    .rei-daerah-container-wrap {
        padding: 14px 10px 14px 14px !important;
        margin-bottom: 20px !important;
        border-radius: 14px !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .rei-daerah-header {
        padding-right: 14px !important;
        margin-bottom: 12px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .rei-daerah-label {
        font-size: 12.5px !important;
    }

    /* Sembunyikan tombol 'Lihat Semua Daerah' di mobile karena semua kota di-scroll horizontal */
    .rei-toggle-more-btn {
        display: none !important;
    }

    /* Container tombol kota di-scroll horizontal */
    .rei-daerah-buttons {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
        scroll-snap-type: x proximity !important;
        gap: 8px !important;
        padding-top: 2px !important;
        padding-bottom: 8px !important;
        padding-right: 14px !important;
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE/Edge */
    }

    .rei-daerah-buttons::-webkit-scrollbar {
        display: none !important; /* Chrome, Safari, iOS, Android */
    }

    /* Pastikan semua tombol kota ditampilkan sebaris & tidak mengecil */
    .rei-daerah-buttons .rei-daerah-btn {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        scroll-snap-align: start !important;
        padding: 7px 14px !important;
        font-size: 13px !important;
    }

    .rei-grid-layout {
        grid-template-columns: 1fr !important;
        gap: 18px !important;
    }

    .rei-card-buttons {
        flex-direction: column !important;
    }

    .rei-btn-menuju-lokasi, .rei-btn-chat-wa {
        width: 100% !important;
    }
}
