/* ===== KGB MAP: Category Color System ===== */
:root {
    --cat-pentadbiran:   #2b8a8f;
    --cat-akademik:      #205c8c;
    --cat-fakulti:       #d4a000;
    --cat-kolej:         #ecaa2b;
    --cat-aktiviti:      #e0468a;
    --cat-sukan:         #8A2BE2;
    --cat-cafe:          #b0a020;
    --cat-kesihatan:     #DC143C;
    --cat-ibadah:        #32CD32;
    --cat-other:         #778899;
}

/* Google Maps-Style Layout */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* App Container - Full viewport */
.app-container {
    position: relative;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Map - Full background */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #ebe7de;
}

/* Search Container - Floating at top, repositions with sidebar */
.search-container {
    position: absolute;
    top: 20px;
    left: 420px; /* To the right of expanded sidebar */
    z-index: 1002;
    width: 380px;
    transition: left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Search repositions when sidebar is collapsed */
.sidebar.collapsed ~ .search-container {
    left: 70px; /* Past the expand button */
}

#search-bar {
    width: 100%;
    padding: 14px 52px 14px 48px;
    border: none;
    border-radius: 24px; /* Pill shape like Google Maps */
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    box-sizing: border-box;
    outline: none;
    font-size: 16px;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%235f6368' d='M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    background-size: 20px 20px;
    color: #202124;
    position: relative;
    z-index: 11;
}

#search-bar:focus {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#search-bar::placeholder {
    color: #5f6368;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    margin-top: -24px;
    padding-top: 28px;
    z-index: 10;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px 12px 48px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
    border-radius: 0 0 16px 16px;
}

/* Result type icons */
.search-result-item::before {
    position: absolute;
    left: 16px;
    top: 14px;
    font-size: 16px;
}

.search-result-item.location::before {
    content: "📍";
}

.search-result-item.category::before {
    content: "🗂️";
}

.result-title {
    font-weight: 500;
    font-size: 14px;
    color: #202124;
    margin-bottom: 2px;
}

.result-subtitle {
    font-size: 12px;
    color: #5f6368;
}

.result-detail {
    font-size: 11px;
    color: #80868b;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-results .no-results {
    padding: 24px 16px;
    text-align: center;
    color: #5f6368;
    font-size: 14px;
}

/* Search results scrollbar */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

/* Hamburger menu button in search bar */
#info-menu-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    border-radius: 8px;
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 0;
    z-index: 12;
}
#info-menu-btn:hover { background: rgba(0,0,0,0.07); }
#info-menu-btn:active { background: rgba(0,0,0,0.12); }

/* Info menu backdrop */
#info-menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#info-menu-backdrop.open {
    display: block;
    opacity: 1;
}

/* Info menu panel */
#info-menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    z-index: 2001;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
#info-menu-panel.open {
    transform: translateX(0);
}

/* Desktop: popup card instead of full-screen slide-in */
@media (min-width: 769px) {
    #info-menu-backdrop {
        background: transparent;
    }

    #info-menu-panel {
        width: 380px;
        height: auto;
        max-height: calc(100vh - 90px);
        top: 68px;
        left: 420px;
        right: auto;
        border-radius: 12px;
        box-shadow: 0 4px 24px rgba(0,0,0,0.2);
        transform: translateY(-8px);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    #info-menu-panel.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

}

/* Hero: aerial image with text + close button overlaid */
.info-menu-hero {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    flex-shrink: 0;
}
.info-menu-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#info-menu-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 20px;
    cursor: pointer;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
    padding: 0;
    z-index: 1;
}
#info-menu-close:hover { background: rgba(0,0,0,0.55); }
.info-menu-hero-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 20px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
}
.info-menu-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin: 0 0 4px 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.info-menu-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Panel sections */
.info-menu-section {
    padding: 20px 24px;
    border-bottom: 1px solid #e8eaed;
}
.info-menu-section:last-child { border-bottom: none; }

.info-menu-section-version {
    font-size: 11px;
    color: #80868b;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.info-menu-sep { color: #dadce0; }

.info-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}
.info-menu-nav-label {
    font-size: 13px;
    color: #5f6368;
}
.info-menu-nav-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.info-menu-nav-btn {
    padding: 7px 14px;
    border-radius: 50px;
    background: #e8f0fe;
    color: #1967d2;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
}
.info-menu-nav-btn:hover { background: #d2e3fc; }

.info-menu-section-feedback { flex: 1; }
.info-menu-feedback-text {
    font-size: 13px;
    color: #5f6368;
    line-height: 1.6;
    margin: 0 0 16px 0;
}
.info-menu-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.info-menu-action-btn {
    padding: 10px 18px;
    border-radius: 50px;
    background: #e8f0fe;
    color: #1967d2;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.info-menu-action-btn:hover { background: #d2e3fc; }

/* Sidebar - Edge-attached collapsible panel (Desktop) */
.sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Collapsed state - slides out to left */
.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    padding-right: 60px; /* Make room for collapse button */
    background: white;
    border-bottom: 1px solid #e8e8e8;
    position: relative;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 8px 0;
    color: #202124;
}

.subtitle {
    font-size: 13px;
    color: #5f6368;
    margin: 0 0 16px 0;
    line-height: 1.4;
}

.list-section-header {
    padding: 12px 20px 8px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.list-section-header h3 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #202124;
}

.list-section-header p {
    margin: 0;
    font-size: 12px;
    color: #5f6368;
}

.btn-reset, .btn-toggle-groups {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    background: #1967d2;
    color: white;
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.btn-reset:hover, .btn-toggle-groups:hover {
    background: #1557b0;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}

.btn-reset:active, .btn-toggle-groups:active {
    background: #0d47a1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    transform: translateY(1px);
}

.btn-toggle-groups {
    margin-bottom: 0;
}

/* Button container for side-by-side layout */
.button-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

/* Sidebar Collapse Button - inside header */
.sidebar-collapse-btn {
    position: absolute;
    top: 16px;
    right: 12px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #5f6368;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-collapse-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #202124;
}

.sidebar-collapse-btn:active {
    background: rgba(0, 0, 0, 0.12);
}

/* Sidebar Expand Button - visible when collapsed */
.sidebar-expand-btn {
    position: absolute;
    top: 20px;
    left: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    background: white;
    border: none;
    border-radius: 0 24px 24px 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    cursor: pointer;
    color: #5f6368;
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s, visibility 0.3s, background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-expand-btn:hover {
    background: #f8f9fa;
    color: #202124;
}

.sidebar-expand-btn:active {
    background: #e8e8e8;
}

/* Show expand button when sidebar is collapsed */
.sidebar.collapsed ~ .sidebar-expand-btn {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.company-list {
    flex-grow: 1;
    overflow-y: auto;
    background: #ededed;
}

/* See on map button row - hidden on desktop */
.stop-map-btn-row {
    display: none;
}

.see-on-map-btn {
    display: none;
}

/* Custom scrollbar */
.company-list::-webkit-scrollbar {
    width: 8px;
}

.company-list::-webkit-scrollbar-track {
    background: transparent;
}

.company-list::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 4px;
}

.company-list::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* Accordion Styles */
.stop-group {
    border-bottom: 1px solid #f1f1f1;
}

.stop-header {
    width: 100%;
    padding: 16px 20px;
    background: white;
    border: none;
    text-align: left;
    font-weight: 700;
    font-size: 14px;
    color: #202124;
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s;
    border-left: 6px solid transparent;
}

.stop-header:hover {
    background: #f8f9fa;
}

.stop-header::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s;
    color: #5f6368;
    flex-shrink: 0;
    margin-left: 8px;
}

.stop-group.collapsed .stop-header::after {
    transform: rotate(-90deg);
}

/* Active category header */
.stop-header.category-active {
    background: #f0f4ff;
}

.company-sub-list {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #ededed;
    padding: 0 0 8px 0;
}

.stop-group.collapsed .company-sub-list {
    max-height: 0;
    padding: 0;
}

/* Category location buttons */
.category-btn {
    width: 100%;
    padding: 10px 20px;
    margin: 0;
    background: #f8f8f8;
    border: none;
    border-bottom: 1px solid #f1f1f1;
    text-align: left;
    font-size: 13px;
    color: #202124;
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-btn:hover {
    background: #f0f0f0;
}

.category-btn.active {
    background: #e8f0fe;
    color: #1967d2;
    font-weight: 500;
    border-left: 3px solid #1967d2;
    padding-left: 17px;
}

.category-btn.no-coords {
    opacity: 0.55;
    cursor: default;
}

.category-btn.no-coords:hover {
    background: #f8f8f8;
}

/* Location number badge in list */
.location-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 28px;
    text-align: center;
    white-space: nowrap;
}

.location-place-name {
    flex: 1;
    line-height: 1.3;
}

.location-short-form {
    font-size: 11px;
    color: #5f6368;
    font-weight: 400;
}

/* No Results Empty State */
.no-results-message {
    display: none;
    text-align: center;
    padding: 60px 40px;
    color: #5f6368;
}

/* Clear Search Button */
.clear-search-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(95, 99, 104, 0.1);
    border-radius: 50%;
    color: #5f6368;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: none;
    transition: all 0.2s;
    padding: 0;
    font-family: Arial, sans-serif;
}

.clear-search-btn:hover {
    background: rgba(95, 99, 104, 0.2);
}

.clear-search-btn:active {
    background: rgba(95, 99, 104, 0.3);
    transform: translateY(-50%) scale(0.95);
}

/* Custom Tooltip Styled as Popup */
.custom-tooltip-popup {
    background: transparent !important;
    border: none !important;
    box-shadow: none;
    padding: 0;
    font-family: 'Google Sans', sans-serif;
    pointer-events: none !important;
    overflow: visible !important;
    width: max-content !important;
    opacity: 0 !important;
    transition: opacity 0.15s ease;
}

/* Show tooltip on hover or when sticky-expanded */
.custom-tooltip-popup.tooltip-visible,
.custom-tooltip-popup.expanded {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.custom-tooltip-popup::before {
    display: none;
}

.custom-tooltip-popup::after {
    display: none;
}

.popup-content-wrapper {
    text-align: center;
    padding: 4px 16px;
    position: relative;
    min-width: 120px;
    overflow: visible;
    transition: min-height 0.3s ease, margin-top 0.3s ease;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Tooltip Close Button - hidden by default */
.tooltip-close-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: #5f6368;
    font-size: 16px;
    font-family: Arial, sans-serif;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* Show close button when tooltip has focus class */
.show-close-btn .tooltip-close-btn {
    display: flex;
}

.tooltip-close-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #202124;
}

.tooltip-close-btn:active {
    background: rgba(0, 0, 0, 0.12);
}

/* Popup buttons row - contains info and directions */
.popup-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.custom-tooltip-popup.expanded .popup-buttons {
    max-height: 80px;
    opacity: 1;
    margin-top: 6px;
    padding-bottom: 4px;
}

/* Info button in tooltip */
.tooltip-info-btn {
    width: 28px;
    height: 28px;
    background: rgba(25, 103, 210, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    font-weight: bold;
    font-style: italic;
    font-family: Georgia, serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
}

.tooltip-info-btn:hover {
    background: rgba(25, 103, 210, 1);
    transform: scale(1.1);
}

/* Tooltip full name shown when expanded */
.popup-location-fullname {
    font-size: 11px;
    color: #5f6368;
    max-width: 140px;
    text-align: left;
    line-height: 1.3;
    word-break: break-word;
}

/* Custom arrow tip - points left toward marker (for right-side tooltips) */
.leaflet-tooltip-right .popup-content-wrapper::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid white;
    filter: drop-shadow(-2px 0 2px rgba(0,0,0,0.1));
    pointer-events: none;
    z-index: 10;
}

/* Arrow points down toward marker (for top tooltips) */
.leaflet-tooltip-top .popup-content-wrapper::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
    pointer-events: none;
    z-index: 10;
}

/* Arrow points right toward marker (for left-side tooltips) */
.leaflet-tooltip-left .popup-content-wrapper::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid white;
    filter: drop-shadow(2px 0 2px rgba(0,0,0,0.1));
    pointer-events: none;
    z-index: 10;
}

/* Expanded state when buttons are visible */
.custom-tooltip-popup.expanded .popup-content-wrapper {
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.popup-category {
    display: none;
    font-family: 'Google Sans', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.custom-tooltip-popup.expanded .popup-category {
    display: inline-block;
}

.popup-stop-name {
    font-family: 'Google Sans', sans-serif;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.3;
    color: #202124;
    display: block;
    position: relative;
    padding: 0;
    z-index: 1;
    white-space: nowrap;
}

.popup-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-sizing: border-box;
    padding: 6px 14px;
    background: #c2eaf2;
    color: #014f5a;
    text-decoration: none;
    text-align: center;
    border-radius: 24px;
    font-family: 'Google Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    white-space: nowrap;
}

.popup-link .material-symbols-outlined {
    font-size: 16px;
    line-height: 1;
}

.popup-link:hover {
    background: #a8dfe9;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    transform: translateY(-1px);
}

.popup-link:active {
    background: #8fd4e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    transform: translateY(0);
}

/* FLOATING ANIMATION FIX: Uses margin-top to avoid GPS transform conflict */
@keyframes bounceDropFloating {
    0% { margin-top: -100px; opacity: 0; }
    60% { margin-top: -38px; opacity: 1; }
    80% { margin-top: -43px; opacity: 1; }
    100% { margin-top: -38px; opacity: 1; }
}

.marker-selected {
    animation: bounceDropFloating 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
}

/* Location Info Overlay - covers sidebar content */
.stop-info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: slideInFromLeft 0.25s ease forwards;
}

.stop-info-overlay.closing {
    animation: slideOutToLeft 0.25s ease forwards;
}

/* Category Overlay - same position/layer as info overlay, opens when a category is selected */
.stop-category-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: slideInFromLeft 0.25s ease forwards;
}

.category-overlay-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    flex-shrink: 0;
    /* border-left color set inline by JS */
}

.category-overlay-badge {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-align: center;
    line-height: 1.3;
    font-family: 'Google Sans', sans-serif;
}

.category-overlay-back {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s;
}

.category-overlay-back:hover {
    background: rgba(0, 0, 0, 0.08);
}

.category-overlay-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #5f6368;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.category-overlay-close:hover {
    background: rgba(0, 0, 0, 0.08);
}

.category-overlay-subtitle {
    font-size: 12px;
    color: #5f6368;
    padding: 8px 16px 6px;
    border-bottom: 1px solid #f1f1f1;
    flex-shrink: 0;
    font-family: 'Google Sans', sans-serif;
}

.category-overlay-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.category-overlay-share-row {
    padding: 10px 16px 6px;
    flex-shrink: 0;
}

.category-overlay-share {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 16px;
    background: #f1f3f4;
    border-radius: 8px;
    color: #3c4043;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Google Sans', sans-serif;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
}

.category-overlay-share:hover {
    background: #e8eaed;
}

.category-overlay-share .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}

@keyframes slideInFromLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutToLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}

.info-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    flex-shrink: 0;
    gap: 12px;
}

.info-overlay-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    white-space: nowrap;
}

.info-overlay-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #202124;
    font-family: 'Google Sans', sans-serif;
    flex: 1;
    line-height: 1.3;
}

.info-overlay-back {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s;
}

.info-overlay-back:hover {
    background: rgba(0, 0, 0, 0.08);
}

.info-overlay-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #5f6368;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.info-overlay-close:hover {
    background: rgba(0, 0, 0, 0.08);
}

.info-overlay-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Text details section in overlay */
.info-overlay-details {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.info-overlay-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    font-size: 14px;
    font-family: 'Google Sans', sans-serif;
    color: #202124;
}

.info-overlay-detail-row:not(:last-child) {
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.info-overlay-detail-label {
    font-size: 11px;
    color: #5f6368;
    font-weight: 500;
    min-width: 60px;
    flex-shrink: 0;
    padding-top: 1px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.info-overlay-detail-value {
    flex: 1;
    line-height: 1.4;
}

.info-overlay-category-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: 'Google Sans', sans-serif;
    line-height: 1.4;
}
.info-overlay-category-badge:hover {
    opacity: 0.85;
}

.info-overlay-directions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 16px;
    background: #c2eaf2;
    border-radius: 8px;
    text-decoration: none;
    color: #014f5a;
    font-weight: 600;
    font-family: 'Google Sans', sans-serif;
    margin-bottom: 16px;
    transition: background 0.2s;
    box-sizing: border-box;
}

.info-overlay-directions .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}

.info-overlay-directions:hover {
    background: #a8dfe9;
}

.info-overlay-share {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 16px;
    background: #f1f3f4;
    border-radius: 8px;
    color: #3c4043;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Google Sans', sans-serif;
    border: none;
    cursor: pointer;
    margin-bottom: 16px;
    transition: background 0.2s;
    box-sizing: border-box;
}

.info-overlay-share:hover {
    background: #e8eaed;
}

.info-overlay-share .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}

/* Toast notification */
#map-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: #323232;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-family: 'Google Sans', sans-serif;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    white-space: nowrap;
}

#map-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Category share icon in sidebar header */
.stop-header-label {
    flex: 1;
}

.category-share-btn {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    border-radius: 4px;
    color: #80868b;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 4px;
    transition: color 0.15s, background 0.15s;
}

.category-share-btn:hover {
    color: #1967d2;
    background: rgba(25, 103, 210, 0.08);
}

.category-share-btn .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}

.info-overlay-image-wrap {
    width: 100%;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

.info-overlay-image {
    width: 100%;
    display: block;
    max-height: 200px;
    object-fit: cover;
}

.info-overlay-image-placeholder {
    display: none;
    height: 110px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #bdc1c6;
    font-size: 12px;
    font-family: 'Google Sans', sans-serif;
    background: #f5f5f5;
}

.info-overlay-image-placeholder .material-symbols-outlined {
    font-size: 36px;
}

/* Mobile Setup */
.mobile-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    padding: 12px 24px;
    background: #202124;
    color: white;
    border: none;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(10px)) {
    @media (max-width: 768px) {
        .sidebar {
            background: rgba(255, 255, 255, 0.98) !important;
        }
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    /* Hide desktop sidebar toggle buttons on mobile */
    .sidebar-collapse-btn,
    .sidebar-expand-btn {
        display: none !important;
    }

    .search-container {
        position: fixed;
        top: 12px;
        left: 12px;
        right: 12px;
        width: auto;
        z-index: 1600;
    }

    /* Reset search container positioning for mobile */
    .sidebar.collapsed ~ .search-container {
        left: 12px;
    }

    #search-bar {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .sidebar {
        /* Position: Bottom sheet anchored to bottom */
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;

        /* Initial state: Peek (22vh) */
        height: 22vh;
        max-height: none;

        /* Visual styling: Semi-transparent with blur */
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);

        /* Rounded top corners only */
        border-radius: 16px 16px 0 0;

        /* Shadow above sheet */
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);

        /* Smooth transitions between states */
        transition: height 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);

        /* Disable desktop collapse transform */
        transform: none !important;

        /* High z-index */
        z-index: 1500;

        overflow: hidden;
        display: flex;
        flex-direction: column;

        /* Safe area support */
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* Ensure collapsed class doesn't affect mobile */
    .sidebar.collapsed {
        transform: none !important;
    }

    /* State: Half-expanded (50% viewport height) */
    .sidebar.sheet-half {
        height: 50vh;
    }

    /* State: Full-expanded (90% viewport height) */
    .sidebar.sheet-full {
        height: 90vh;
    }

    /* Drag handle styles */
    .sheet-handle {
        display: block;
        width: 100%;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: grab;
        background: transparent;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .sheet-handle:active {
        cursor: grabbing;
    }

    .handle-bar {
        width: 40px;
        height: 4px;
        background: #dadce0;
        border-radius: 2px;
        transition: background 0.2s;
    }

    .sheet-handle:hover .handle-bar,
    .sheet-handle:active .handle-bar {
        background: #bdc1c6;
    }

    /* Adjust sidebar header for bottom sheet */
    .sidebar-header {
        padding: 12px 20px;
        padding-right: 20px;
        flex-shrink: 0;
    }

    .sidebar-header h2 {
        font-size: 16px;
        margin: 0 0 4px 0;
    }

    .subtitle {
        font-size: 12px;
        margin: 0 0 12px 0;
    }

    /* Company list must be scrollable */
    .company-list {
        flex-grow: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide old mobile toggle button */
    .mobile-toggle {
        display: none !important;
    }

    /* See on map button row - below location header (mobile only) */
    .stop-map-btn-row {
        display: block;
        padding: 8px 16px 12px 16px;
        background: white;
    }

    .see-on-map-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 16px;
        background: #c2eaf2;
        color: #014f5a;
        border: none;
        border-radius: 50px;
        font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        margin-left: 4px;
    }

    .see-on-map-btn:active {
        background: #a8dce6;
    }

    /* Info overlay - offset below handle on mobile */
    .stop-info-overlay {
        top: 24px;
        border-radius: 0;
        animation: slideInFromBottom 0.25s ease forwards;
    }

    .stop-info-overlay.closing {
        animation: slideOutToBottom 0.25s ease forwards;
    }

    /* Category overlay — same mobile offset as info overlay */
    .stop-category-overlay {
        top: 24px;
        border-radius: 0;
        animation: slideInFromBottom 0.25s ease forwards;
    }

    @keyframes slideInFromBottom {
        from { transform: translateY(100%); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    @keyframes slideOutToBottom {
        from { transform: translateY(0); opacity: 1; }
        to { transform: translateY(100%); opacity: 0; }
    }

    /* Top-direction tooltips: don't shift up on expand — keeps arrow on marker */
    .custom-tooltip-popup.expanded .popup-content-wrapper {
        transform: translateY(0);
    }

    /* Title and subtitle moved to info menu panel on mobile */
    .sidebar-header h2,
    .sidebar-header .subtitle {
        display: none;
    }

    /* Show "Senarai Lokasi" label above the action buttons on mobile */
    .list-section-header { order: 1; }
    .sidebar-header { order: 2; }
    .company-list { order: 3; }

}

/* Map text labels (lakes, areas, etc.) */
.map-text-label {
    display: inline-block;
    font-family: 'Google Sans', sans-serif;
    font-weight: 600;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 0 6px rgba(0,0,0,0.5);
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    letter-spacing: 0.04em;
    text-align: center;
    line-height: 1.4;
    transform: translate(-50%, -50%);
}

/* Selected marker highlight — scales up with white ring glow */
.marker-highlighted > div {
    transform: scale(1) !important;
    box-shadow: 0 0 0 2.5px white, 0 0 0 5px rgba(0,0,0,0.4), 0 4px 8px rgba(0,0,0,0.35) !important;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.15s ease !important;
    z-index: 999 !important;
}

/* Map data version/update info — hidden in sidebar (shown in info menu panel) */
#map-data-info {
    display: none;
    padding: 8px 16px 4px;
    font-size: 11px;
    color: #80868b;
    border-top: 1px solid #e8eaed;
    flex-shrink: 0;
    line-height: 1.5;
}
.map-data-sep {
    margin: 0 4px;
}

/* Sidebar navigation footer — hidden in sidebar (shown in info menu panel) */
.sidebar-nav-footer {
    display: none;
    padding: 12px 16px;
    font-size: 12px;
    color: #80868b;
    border-top: 1px solid #e8eaed;
    flex-shrink: 0;
}
.sidebar-nav-footer a {
    color: #1967d2;
    text-decoration: none;
}
.sidebar-nav-footer a:hover {
    text-decoration: underline;
}
