:root {
    --primary-color: #4F46E5;
    /* Indigo 600 */
    --primary-dark: #4338ca;
    --accnet-color: #818cf8;
    --bg-color: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --font-sans: 'Inter', sans-serif;
    --header-height: 60px;
    --nav-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* App-like feel */
}

/* Header */
header {
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

header button.info-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
}

header button.info-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent double scrollbars */
    position: relative;
    width: 100%;
}

/* Map Section - Mobile Default */
#map-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 40%;
    flex-shrink: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

#map-container {
    flex: 1;
    width: 100%;
}

/* List/Table Section */
#shelter-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Handle overflow in children */
    background-color: var(--bg-color);
    padding: 0;
}

#shelter-list-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: 3rem;
}

.capacity-note {
    background-color: #fee2e2;
    color: #991b1b;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.shelter-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

.shelter-card:active {
    transform: scale(0.98);
}

.shelter-card.active {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.shelter-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.shelter-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

.shelter-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 0.5rem;
}

.badge-congregate {
    background: #fee2e2;
    color: #991b1b;
}

/* Red-ish */
.badge-non-congregate {
    background: #d1fae5;
    color: #065f46;
}

/* Green-ish */
.badge-managed {
    background: #e0e7ff;
    color: #3730a3;
}

/* Indigo-ish */

.shelter-info-row {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Detail View (Modal/Overlay) */
.detail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.detail-overlay.open {
    transform: translateY(0);
}

.detail-header {
    padding: 1rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.detail-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.detail-row {
    margin-bottom: 1rem;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.5;
}

/* Info Screen (About) */
.info-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 3000;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.info-screen.open {
    transform: translateX(0);
}

/* Utilities */
.hidden {
    display: none;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    #main-content {
        flex-direction: row;
    }

    #map-section {
        width: 60%;
        height: 100%;
        order: 2;
        border-left: 1px solid var(--border-color);
        /* Reset mobile specific properties if needed */
        flex-shrink: 1;
        box-shadow: none;
        /* Shadow handled by container or similar? */
    }

    #shelter-list-container {
        width: 40%;
        height: 100%;
        order: 1;
        padding-bottom: 1rem;
    }

    .detail-overlay {
        width: 40%;
        right: auto;
        border-right: 1px solid var(--border-color);
        box-shadow: var(--shadow-xl);
    }
}

/* Info Screen Styling */
.info-screen .back-btn {
    color: white;
}


/* Status Banner */
.status-banner {
    background-color: #F59E0B;
    /* Amber 500 */
    color: white;
    text-align: center;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 1001;
    /* Above header */
}

/* Availability Labels */
.status-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.status-label.available {
    color: #10B981;
}

/* Emerald 500 */
.status-label.closed {
    color: #EF4444;
}

/* Red 500 */

.open-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.open-label.open {
    color: #059669;
}

/* Map Legend */
.map-legend {
    background: white;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.green {
    background-color: #10B981;
}

.legend-dot.red {
    background-color: #EF4444;
}

/* Action Buttons Area */
.map-actions {
    background: white;
    padding: 0.75rem;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.action-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn:hover {
    background-color: var(--primary-dark);
}

/* Google Maps Link */
.gmaps-link {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.gmaps-link:hover {
    text-decoration: underline;
}

/* Map Marker Styles (Leaflet DivIcon) */
.marker-pin {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.marker-pin.available {
    background-color: #10B981;
    transform: scale(1.1);
}

.marker-pin.closed {
    background-color: #EF4444;
}

/* Grayscale Map */
.leaflet-tile-pane {
    filter: grayscale(100%);
}