/* ============================================================
   PROFESSIONAL COASTAL FLOODING DASHBOARD THEME
   ============================================================ */

/* Vigilance Colors variables */
:root {
    --color-green: #28a745;    /* No Flood */
    --color-yellow: #ffc107;   /* Warning */
    --color-orange: #fd7e14;   /* High Risk */
    --color-red: #dc3545;      /* Severe Flood */
    --color-dark-bg: #2b3e50;  /* Dark Blue/Gray Background */
    --color-sidebar: #3e4a55;  /* Sidebar/Card Header */
    --navbar-height: 56px; /* Standard Bootstrap navbar height */
}

html, body {
    height: 100%;
    overflow: hidden; /* Prevent scrolling of the main page */
}

/* General App Content Spacing */
.app-content {
    /* Fill remaining height below navbar */
    height: calc(100vh - var(--navbar-height));
    padding: 0;
    overflow: hidden;
    position: relative;
}

.tab-content-area {
    height: 100%;
    width: 100%;
}

/* ------------------------------------------------------------
   FLEX LAYOUT
   ------------------------------------------------------------ */

.flex-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%; /* Important: Fill the container */
    position: relative;
}

/* ------------------------------------------------------------
   SIDEBAR (Responsive)
   ------------------------------------------------------------ */

.sidebar {
    background-color: var(--color-dark-bg);
    color: white;
    padding: 15px;
    width: 400px; /* Desktop width */
    height: 100%; /* Full height */
    overflow-y: auto; /* Scrollable content */
    z-index: 1000;
    transition: transform 0.3s ease-in-out, margin-left 0.3s ease-in-out;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Collapsed state */
.sidebar-collapsed {
    margin-left: -400px; /* Hide by moving off-canvas */
}

/* Expanded state */
.sidebar-expanded {
    margin-left: 0;
}

/* Sidebar styling for Hist matches main Sidebar */
#sidebar-hist {
    width: 400px;
}

/* ------------------------------------------------------------
   MAIN PANEL (Map Area)
   ------------------------------------------------------------ */
.main-panel {
    flex-grow: 1;
    height: 100%;
    min-width: 0;
    position: relative;
}

#Forecast_map_container, #Historical_plot {
    width: 100%;
    height: 100%; /* Fills the main panel */
    position: relative;
}

/* ------------------------------------------------------------
   SIDEBAR TOGGLE BUTTON
   ------------------------------------------------------------ */
#sidebar-toggle {
    position: absolute;
    top: 10px; /* Relative to main panel, not fixed to window */
    left: 10px;
    z-index: 1100; /* Above sidebar and map */
    background: #3e4a55;
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 20px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ------------------------------------------------------------
   FLOATING ELEMENTS (Map Overlays)
   ------------------------------------------------------------ */

/* Legend: Top Right */
.risk-legend-box {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255,255,255,0.95);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 900;
    font-size: 0.85rem;
    max-width: 200px;
}

/* Date Display: Bottom Right (Fixed from absolute pixel values) */
.current-date-display-box {
    position: absolute;
    bottom: 25px; 
    left: 10px; /* Anchored to right */
    top: auto;   /* Reset top */
    right: auto;  /* Reset left */
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9rem;
    z-index: 900;
    pointer-events: none; /* Let clicks pass through */
}

/* Chart Popup: Responsive */
.chart-popup-container {
    width: 100%;
    min-width: 300px;
    max-width: 500px;
    height: 250px; /* reduced height slightly for mobile */
}

/* ------------------------------------------------------------
   SIDEBAR CARDS / UI ELEMENTS
   ------------------------------------------------------------ */

.sidebar-card {
    background-color: var(--color-sidebar);
    border: none;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-header {
    font-size: 1.1rem;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.form-group label {
    font-size: 1rem;
    font-weight: bold;
    margin-top: 10px;
}

/* ------------------------------------------------------------
   MAP + OVERLAYS
   ------------------------------------------------------------ */
#Forecast_map_container {
    position: relative;
    height: 70vh;
    border-radius: 2px;
    overflow: hidden;
}

.leaflet-map-plot {
    width: 100%;
    height: 100%;
}


/* ------------------------------------------------------------
   OTHER UI COMPONENTS
   ------------------------------------------------------------ */

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.legend-color-box {
    width: 15px;
    height: 15px;
    border: 1px solid #333;
    margin-right: 8px;
    border-radius: 50%;
}

#event-selection-group {
    display: none;
}


/* Popups */
.water-level-popup .leaflet-popup-content-wrapper {
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* ------------------------------------------------------------
   Utility Styles (Tailwind-like)
   ------------------------------------------------------------ */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.p-3 { padding: 0.75rem; }
.p-0 { padding: 0; }
.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-bold { font-weight: 700; }
.text-white { color:white; }
.text-blue-400 { color:#60a5fa; }
.text-slate-300 { color:#cbd5e1; }
.text-slate-500 { color:#64748b; }
.bg-slate-700 { background:#475569; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.py-1 { padding-top:0.25rem; padding-bottom:0.25rem; }
.table-auto { table-layout:auto; }
.w-full { width:100%; }

/* Pulse animation for severe risk */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220,53,69,0.4); }
  70% { transform: scale(1.2); box-shadow: 0 0 0 15px rgba(220,53,69,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220,53,69,0); }
}

.pulse-severe { animation: pulse 1.5s infinite; }

/* ------------------------------------------------------------
   NAVIGATION BAR SETUP
   ------------------------------------------------------------ */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px; 
    padding-top: 0;
    padding-bottom: 0;
}

#navbar-brand {
    margin-left: 60px;
    height: 100%;
    display: flex;
    align-items: center;
}

#navbar-logo {
    height:100%; 
    max-height: 70px;   /* keeps it safely inside navbar */
    width: auto;
    display: block;
    object-fit: contain; 
}

#navbar-brand:hover #navbar-logo {
    opacity: 0.99;
    transition: opacity 0.2s ease-in-out;
}

/* ------------------------------------------------------------
   MOBILE SPECIFIC TWEAKS (@media)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    /* 1. Sidebar becomes an overlay on mobile */
    .sidebar {
        position: absolute; /* Overlay on top of map */
        width: 85%;         /* Take up most of screen but leave a gap */
        max-width: 350px;
        box-shadow: 4px 0 10px rgba(0,0,0,0.5);
    }

    .sidebar-collapsed {
        margin-left: -100%; /* Fully hide off screen */
    }

    /* 2. Adjust Sidebar width for History tab too */
    #sidebar-hist {
        width: 85%;
        max-width: 350px;
    }

    /* 3. Move Legend to Bottom Left or make smaller to avoid clutter */
    .risk-legend-box {
        top: auto;
        /*bottom: 60px; /* Above the date display */
        right: 10px;
        font-size: 0.75rem;
        padding: 5px;
    }
    
    .current-date-display-box {
        font-size: 0.75rem;
        bottom: 15px;
        right: 10px;
    }

    /* 4. Chart Popup text size */
    .chart-popup-container {
        min-width: 260px;
        height: 200px;
    
    #navbar-logo {
        height: 36px;
    }
}
