/* --- GLOBAL RESET & TYPOGRAPHY --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* Update: Ensure internal content strictly follows the iframe size */
html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent the internal iframe from having its own scrollbar */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
}

/* DELETE or replace .map-page and .page with this: */
.map-page, .page {
    height: 100%;
    width: 100%;
    position: relative;
    display: block;
}

/* Update: Map MUST be 100% of the iframe, not the viewport */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
}

/* Update: Added a small buffer for aesthetic breathing room below the Navbar */
.main-search-container {
    width: 95%;
    max-width: 390px;
    top: 20px; /* Adjust this value if you want the panel higher or lower */
}

#search-and-toggle-group {
    background: rgba(255, 255, 255, 0.9); /* More transparent for glass effect */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5); /* Enterprise "inner stroke" */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.3s ease;
}
/* Custom Scrollbar for Region Chips */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* --- REGION CHIPS (Interactive Legend) --- */
.region-chip {
    height: 32px;
    padding: 0 14px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569; /* Balanced slate for readability */
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.region-chip:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: rgba(220, 38, 38, 0.02);
}

.region-chip:active {
    transform: scale(0.94);
    background: #f1f5f9;
}

#regionChips .region-chip.active {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    animation: active-pulse 2s infinite;
}

/* --- VERTICAL DROPDOWN SIDEBAR --- */
#info-sidebar {
    /* 1. Layout: Remove fixed positioning to let it stack naturally */
    position: relative;
    width: 100%;
    
    /* 2. Initial State: Collapsed and Hidden */
    max-height: 0;
    opacity: 0;
    overflow: hidden; /* Critical for the "Slide" effect */
    transform: translateY(-10px) scale(0.98);
    pointer-events: none;
    
    /* 3. Visuals: Glassmorphism matching Search Bar */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* 4. Animation curve */
    transition: 
        max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease,
        transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        margin-top 0.3s ease;
    
    z-index: 90;
}

#info-sidebar.open {
    /* 5. Active State: Expanded */
    max-height: 75vh; /* Drop down to max 75% of screen height */
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    margin-top: 12px; /* Professional gap between search and details */
    overflow-y: auto; /* Allow scrolling inside the card if content is long */
}

#sidebar-content span {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    transform: scale(0.5);
    display: inline-block;
}

#resetMapBtn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#resetMapBtn:hover {
    background: #dc2626 !important;
    transform: rotate(-180deg) scale(1.1);
    color: white;
}

.hub-hero-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f1f5f9;
    border-radius: 12px 12px 0 0;
}

/* --- ANIMATIONS --- */
@keyframes active-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

@keyframes popIn {
    to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    to { background-position-x: -200%; }
}

/* --- LOADING SKELETONS --- */
.skeleton {
    
    background-size: 200% 100%;
    animation: shimmer 1.8s linear infinite;
    border-radius: 6px;
}

/* --- MAPBOX CUSTOMIZATION --- */
.mapboxgl-ctrl-geocoder {
    width: 100% !important;
    max-width: none !important;
    border-radius: 10px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    background-color: #f8fafc !important;
}

/* --- MOBILE ADAPTATION --- */
@media (max-width: 640px) {
    .main-search-container {
        width: calc(100% - 32px);
        left: 16px;
        top: 10px;
    }
    
    #info-sidebar {
        position: fixed; /* Fix for mobile bottom sheets */
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 65%;
        transform: translateY(100%);
        border-radius: 24px 24px 0 0;
        margin-top: 0;
    }
    
    #info-sidebar.open {
        transform: translateY(0);
    }
}


/* --- MOBILE-OPTIMIZED CHIP CAROUSEL --- */
.legend-chips-container {
    position: absolute;
    bottom: 32px; /* Sufficient clearance for Mapbox attribution */
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    gap: 10px;
    padding: 0 20px; /* Side padding for scroll "bleed" */
    overflow-x: auto; /* Enable horizontal scroll on mobile */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    pointer-events: none;
    justify-content: center; /* Center on desktop */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.legend-chips-container::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.legend-chips-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.legend-chip-item {
    flex-shrink: 0; /* Prevents chips from squishing on mobile */
    height: 38px; /* Slightly taller for better touch-target on mobile */
    padding: 0 16px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 19px;
    box-shadow: 0 2px 6px rgba(60, 64, 67, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    cursor: pointer;
}

/* Mobile-Specific Adjustment */
@media (max-width: 640px) {
    .legend-chips-container {
        justify-content: flex-start; /* Alignment for carousel feel */
        bottom: 24px;
    }
}



/* --- ENTERPRISE SIDEBAR DESIGN SYSTEM (Synced with Search Bar) --- */

.profile-card-header {
    position: relative;
    /* Spacing synced with .main-search-container padding */
    margin: 12px 24px 0 24px !important; 
    padding: 45px 20px 20px 20px !important; /* Top padding clears the floating logo */
    
    /* Glassmorphism Logic from #search-and-toggle-group */
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    text-align: center;
    z-index: 10;
}

/* Precise Action Bar Geometry */
.action-bubble-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9; /* Slate-100 */
}

.action-bubble-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-bubble-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    /* Border synced with .region-chip */
    border: 1px solid #e2e8f0; 
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569; /* Slate-600 */
    font-size: 18px;
    background: #ffffff;
    transition: all 0.2s ease;
}

.action-bubble-btn:hover .action-bubble-icon {
    border-color: #dc2626;
    color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Structured Information Grid */
.service-capability-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 24px; /* Matches header side margins */
    margin-bottom: 24px;
}

.capability-item {
    background: #ffffff;
    border: 1px solid #e2e8f0; /* Matches .region-chip */
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.capability-item:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
}

/* --- LOGO & COVER LOGIC --- */

.hub-logo-wrapper {
    position: absolute;
    top: -45px; /* Perfect overlap for 80px height */
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Elevation shadow synced with enterprise style */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 4px solid #ffffff;
    z-index: 20;
    overflow: hidden;
}

.hub-logo-circular {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.check-glyph {
    color: #16a34a; /* Slightly more vibrant Green */
    font-weight: 700;
}

/* Typography Overrides to match Search Bar exactly */
.profile-card-header h2 {
    font-weight: 600 !important;
    color: #1e293b !important; /* Slate-800 */
    letter-spacing: -0.025em;
}

.profile-card-header h3 {
    font-weight: 700 !important;
    color: #64748b !important; /* Slate-500 */
    letter-spacing: 0.05em;

}
