/* --- GLOBAL RESET & FONTS --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Roboto', sans-serif;
    color: #fff;
    background: #28282B;
    overflow: hidden;
    height: 100vh;
}

h1, h2, h3 { font-family: 'Montserrat', sans-serif; }

/* --- HEADER --- */
/* --- HEADER STYLES --- */
.main-header {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 60px;
    padding: 0 2vw; 
    
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px); 
    z-index: 999; 
    
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    
    /* FIX: Prevent layout breaking on very small screens */
    min-width: 600px; 
}

/* 1. LOGO (Locked) */
.logo { 
    display: flex; 
    flex-direction: column; 
    line-height: 1; 
    flex-shrink: 0; /* Never shrink */
    margin-right: 20px;
}
.logo-main { font-family: 'Montserrat', sans-serif; font-size: 1.8em; font-weight: 900; color: #ed4801; }
.logo-sub { font-size: 0.65em; font-weight: 400; color: #ccc; letter-spacing: 2px; text-transform: uppercase; margin-top: 2px; }

/* 2. NAVIGATION (Locked) */
.main-nav {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Never shrink */
    margin-left: 20px;
}

.main-nav .nav-link { 
    color: #ccc; 
    text-decoration: none; 
    font-weight: 500; 
    font-size: 0.9em; 
    padding: 8px 15px; 
    border-radius: 6px; 
    transition: all 0.3s ease; 
    margin-left: 10px;
    
    /* FIX: Keep text on one line */
    white-space: nowrap; 
}
.main-nav .nav-link { 
    color: #ccc; 
    text-decoration: none; 
    font-weight: 500; 
    font-size: 0.9em; 
    padding: 8px 15px; 
    border-radius: 6px; 
    transition: all 0.3s ease; 
    margin-left: 10px;
    
    /* FIX: Keep text on one line */
    white-space: nowrap; 
    
    /* FIX: Add invisible border so it doesn't jump when active */
    border: 1px solid transparent; 
}

.main-nav .nav-link:hover { 
    color: white; 
    background-color: rgba(255, 255, 255, 0.1); 
}

.main-nav .nav-link.active { 
    color: #ed4801; 
    border: 1px solid #ed4801; 
}

/* --- SEARCH BAR (Stabilized) --- */
.search-container { 
    display: flex; 
    align-items: center; 
    background: rgba(255, 255, 255, 0.1); 
    border-radius: 20px; 
    padding: 8px 15px; 
    
    /* FIX: Remove 'clamp'. Use standard width so it stops jittering. */
    width: 100%; 
    max-width: 400px; 
    
    transition: background 0.3s ease; 
}

.search-container:hover { 
    background: rgba(255, 255, 255, 0.15); 
}

.search-input { 
    flex-grow: 1; 
    border: none; 
    background: transparent; 
    color: white; 
    font-size: 0.9em; 
    padding: 0; 
    outline: none; 
}

.search-icon { 
    color: #ed4801; 
    margin-left: 5px; 
    cursor: pointer; 
}

.clear-icon { 
    color: #ccc; 
    margin-right: 10px; 
    cursor: pointer; 
}

.clear-icon.hidden { 
    display: none; 
}

/* --- HERO --- */
.hero {
    margin-top: 60px;
    height: calc(100vh - 60px);
    width: 100%;
    background: url('images/bg2-logan.jpg') center/cover no-repeat fixed;
    
    /* FLEXBOX MAGIC */
    display: flex;
    align-items: stretch; /* Make both columns full height */
    flex-wrap: nowrap;    /* Desktop: Side-by-side. Mobile: We change this via media query */
    
    padding: 0; 
    gap: 0; 
}
/* --- SIDEBAR WRAPPER --- */
.sidebar-wrapper {
    display: flex; 
    flex-direction: column;
    flex: 0 0 400px;
    width: 400px;
    
    height: 100%;
    
    background: rgba(0, 0, 0, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    /* overflow: hidden; */
    z-index: 10;
}

/* --- FILTER BAR --- */
.filter-bar {
    display: flex; gap: 8px; padding: 15px;
    background: rgba(0,0,0,0.3); border-bottom: 1px solid rgba(255,255,255,0.1);
    align-items: center;
}

.filter-bar-c {
    display: flex; gap: 8px; width: 100%;
    justify-content: center; align-items: center; flex-direction: column;
}


.filter-bar-r {
    display: flex; gap: 8px; width: 100%;
    justify-content: space-between; align-items: center; flex-direction: row;
}

.filter-select { background: rgba(99, 97, 97, 0.1); color: #acabab; border: 1px solid #555; border-radius: 4px; padding: 5px; font-size: 0.8rem; outline: none; cursor: pointer; flex-grow: 1; min-width: 0; }
.pulse-btn, .icon-btn { flex-shrink: 0; }
.icon-btn { background: #ed4801; color: white; border: none; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pulse-btn { background: linear-gradient(135deg, #ed4801, #ff7e42); color: white; border: none; border-radius: 50%; width: 35px; height: 35px; cursor: pointer; box-shadow: 0 0 10px rgba(237, 72, 1, 0.5); display: flex; align-items: center; justify-content: center; animation: pulse-glow 2s infinite; }
@keyframes pulse-glow { 0% { box-shadow: 0 0 0 0 rgba(237, 72, 1, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(237, 72, 1, 0); } }
.separator { width: 1px; background: rgba(255,255,255,0.2); margin: 0 5px; height: 20px; }

/* --- SIDEBAR LIST --- */
.sidebar {
    width: 100%; height: 100%;
    background: transparent; border: none; box-shadow: none;
    padding: 10px; overflow-y: auto; overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(237, 72, 1, 0.5); border-radius: 10px; }

/* --- ALERT BOXES --- */
.alert-box { display: flex; align-items: center; background: rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 16px; margin-bottom: 10px; cursor: pointer; transition: transform 0.2s ease, background 0.2s; border-left: 4px solid transparent; }
.alert-box:hover { background: rgba(255, 255, 255, 0.2); transform: translateX(5px); }
.alert-box.selected { background: rgba(237, 72, 1, 0.3); border-left: 4px solid #ed4801; }
.alert-box.unread { background: rgba(255, 255, 255, 0.15); border-left: 3px solid #ed4801; opacity: 1; }
.alert-icon { width: 12px; height: 12px; background-color: #ed4801; border-radius: 50%; margin-right: 15px; flex-shrink: 0; }
.box-text { display: flex; flex-direction: column; }
.box-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; color: #fff; text-transform: uppercase; }
.box-subtitle { font-size: 0.8rem; color: #ccc; }
.active-alert-counter{ padding: 5px 10px 5px 10px; text-align: left; }


/* --- DETAIL BOX (ANIMATED) --- */
.detail-box {
    display: flex; 
    flex-direction: column;
    
    /* FIX: Take up all remaining space */
    flex: 1; 
    
    /* FIX: Prevents the box from forcing the screen wider if text is long */
    min-width: 0; 
    
    /* Keep it floating */
    height: calc(100% - 40px); /* Full height minus margins */
    margin: 20px; 
    
    background: rgba(0,0,0,0.9);
    padding: 30px;
    border-radius: 15px;
    color: #fff;
    border: 1px solid #ed4801;
    z-index: 20;

    /* Animation: Hidden by default */
    opacity: 0;
    transform-origin: top right; 

    transform: scale(0.9) translateX(0); 
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    pointer-events: none;
    backdrop-filter: blur(5px);
}

/* Animation: Visible state */
.detail-box.active {
    opacity: 1;
    transform: scale(1) translateX(0); 
    pointer-events: auto;
    box-shadow: -10px 10px 30px rgba(0,0,0,0.5);
}
/* --- DETAIL CONTENT --- */
.detail-header-r { display: flex; flex-direction: row; justify-content: space-between; margin: 0 0 10px; align-items: center; }
.detail-title { font-size: 24px; font-weight: 700; margin: 0; width: 70%; }
.detail-redirect { font-size: 14px; color: #f6510a; text-decoration: none; border: 1px solid #f6510a; padding: 5px 10px; border-radius: 4px; transition: 0.3s; }
.detail-redirect:hover { background: #f6510a; color: white; }
.detail-line { border: none; border-top: 1px solid #ed4801; margin-bottom: 20px; }
.detail-important-r { display: flex; flex-direction: row; justify-content: space-between; margin-top: 10px; }
.detail-row1-c { display: flex; flex-direction: column; gap: 15px; flex: 1; }
.detail-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 5px; }
.detail-content { margin-top: 50px; line-height: 1.6; font-size: 0.95rem; max-height: 400px; overflow-y: auto; color: #ddd; }
.detail-row1-col2-r { display: flex; flex-direction: row;  gap: 20px; align-items: flex-start; }


.detail-content::-webkit-scrollbar { width: 6px; }
.detail-content::-webkit-scrollbar-track { background: transparent; }
.detail-content::-webkit-scrollbar-thumb { background: rgba(237, 72, 1, 0.5); border-radius: 10px; }
.detail-content::-webkit-scrollbar-thumb:hover { background: rgba(237, 72, 1, 1); }


/* Buttons */
.action-buttons { display: flex; gap: 10px; }
.action-btn { border: none; padding: 5px 12px; border-radius: 4px; color: white; font-size: 0.8rem; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.verify-btn { background: #00C851; } .verify-btn:hover { background: #00e25b; }
.resolve-btn { background: #33b5e5; } .resolve-btn:hover { background: #4ec2ec; }
.detail-redirect { border: 1px solid #ed4801; color: #ed4801; padding: 5px 12px; border-radius: 4px; text-decoration: none; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; }
.detail-redirect:hover { background: #ed4801; color: white; }
/* .status-badge { margin-top: 5px; font-size: 0.8rem; padding: 2px 8px; border-radius: 4px; background: #555; display: inline-block; } */
.confirm-btn { background: #ed4801; } .resolve-btn:hover { background: #4ec2ec; }

/* --- STATUS BADGE COLOR CLASSES --- */
/* These classes are applied via JavaScript to synchronize with button clicks */

.status-badge { 
    margin-top: 5px; 
    font-size: 0.8rem; 
    padding: 2px 8px; 
    border-radius: 4px; 
    background: #555; 
    display: inline-block; 
    font-weight: bold; /* Added for clarity */
    text-transform: uppercase;
    transition: background-color 0.2s; /* Added transition */
    color: white; /* Base text color */
}

/* Status: NEW (Default State/Unverified) */
.status-new {
    background-color: #555; /* Amber/Yellow ffc107 333 */
    color: #ffffff;
}

/* Status: VERIFIED */
.status-verified {
    background-color: #ffc107; /* Green */
    color: #ffffff;
}

/* Status: RESOLVED */
.status-resolved {
    background-color: #28a745; /* Gray 28a745*/
    color: #ffffff;
}

/* Base Style for all action buttons (like 'Post' or 'Verify') */
.action-btn1 {
    /* Basic button styling (adjust padding, font, etc., as needed) */
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    
    /* Ensure icon and text are aligned */
    display: inline-flex;
    align-items: center;
    gap: 5px; /* Spacing between icon and text */
}

/* 1. Default (Unverified) State: Green Outline only */
#verify-btn {
    background-color: transparent;
    color: #ffc107; /* Green text color */
    border: 1px solid #ffc107; /* Green border (outline) */
}

/* 2. Verified State: Entirely Green */
#verify-btn.is-verified {
    background-color: #ffc107; /* Solid Green background */
    color: #ffffff; /* White text/icon */
    border-color: #ffc107; /* Maintain border color */
}

/* 3. Hover States */
#verify-btn:hover:not(.is-verified) {
    background-color: rgba(40, 167, 69, 0.1); /* Light green background on hover */
}

#verify-btn.is-verified:hover {
    /* Make the button slightly darker green on hover when it's already verified */
    background-color: #c77f0c; 
}

/* --- RESOLVE BUTTON --- */
/* 1. Default (Unresolved) State: Blue Outline only */
#resolve-btn {
    background-color: transparent;
    color: #28a745; /* Blue text color */
    border: 1px solid #28a745; /* Blue border (outline) */
}

/* 2. Resolved State: Entirely Blue */
#resolve-btn.is-resolved {
    background-color: #28a745; /* Solid Blue background */
    color: #ffffff; /* White text/icon */
    border-color: #28a745;
}

/* 3. Hover States (When Unresolved) */
#resolve-btn:hover:not(.is-resolved) {
    background-color: rgba(0, 123, 255, 0.1); /* Light blue background on hover */
}

/* 4. Hover States (When Already Resolved) */
#resolve-btn.is-resolved:hover {
    /* Make the button slightly darker blue on hover when it's already resolved */
    background-color: #157349; 
}


/* --- MODAL --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 1; transition: opacity 0.3s ease; }
.modal-overlay.hidden { opacity: 0; pointer-events: none; display: none !important; }
.modal-content { background: #1a1a1a; border: 1px solid #444; padding: 30px; border-radius: 12px; width: 90%; max-width: 900px; }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.charts-container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-top: 20px; }
.chart-wrapper { background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 20px; flex: 1; min-width: 300px; max-height: 400px; display: flex; flex-direction: column; align-items: center; }
canvas { max-width: 100%; max-height: 300px; }
.icon-btn-ghost { background: transparent; border: none; color: #888; font-size: 1.5rem; cursor: pointer; }
.hidden { display: none !important; }

/* --- RESPONSIVE ADJUSTMENT --- */
@media (max-width: 850px) {
    /* Unlock the body scrolling for small screens */
    body { 
        overflow: auto; 
        height: auto; 
    }

    .hero {
        /* Stack vertically instead of side-by-side */
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar-wrapper {
        /* Sidebar becomes full width banner at the top */
        width: 100%;
        flex: none; /* Turn off the fixed 350px logic */
        height: 300px; /* Fixed height for list */
    }

    .detail-box {
        /* Box sits below sidebar */
        width: 95%; /* Almost full width */
        margin: 10px auto; /* Center it */
        height: 500px; /* Fixed height for content */
        flex: none;
        
        /* Reset transform for mobile so it doesn't fly in weirdly */
        transform: none; 
    }
    
    /* Ensure active state just shows opacity on mobile */
    .detail-box.active {
        transform: none;
    }
}

/* --- LOGIN MODAL STYLES --- */
.small-modal { max-width: 400px; }

.login-form {
    display: flex; flex-direction: column; gap: 15px;
}

.login-input {
    background: rgba(255,255,255,0.1);
    border: 1px solid #444;
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
}
.login-input:focus { border-color: #ed4801; }

.full-width {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 1rem;
}

/* --- SIDEBAR ASSISTANCE BADGE --- */
.assist-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border: 1px solid #555;
}

/* Specific Colors */
.assist-medical { color: #ff4444; border-color: #ff4444; background: rgba(255, 68, 68, 0.1); }
.assist-rescue { color: #ffbb33; border-color: #ffbb33; background: rgba(255, 187, 51, 0.1); }
.assist-food { color: #00C851; border-color: #00C851; background: rgba(0, 200, 81, 0.1); }
.assist-evac { color: #33b5e5; border-color: #33b5e5; background: rgba(51, 181, 229, 0.1); }


/* --- CUSTOM TOOLTIP STYLES --- */

/* 1. Base style for any element that has a tooltip */
[data_tooltip] {
    position: relative;
    cursor: pointer;
}

/* 2. Create the tooltip content (::after) ALWAYS, but invisible */
[data_tooltip]::after {
    content: attr(data_tooltip);
    position: absolute;
    top: calc(100% + 15px);
    
    /* DEFAULT POSITIONING: Centered over parent */
    left: 50%; 
    right: auto;
    transform: translateX(-50%);
    margin: 0; 
    
    /* Appearance & Visibility */
    background-color: #ed4801;
    color: #fff;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s; 
    transition-delay: 0s; /* Instant disappearance */
    z-index: 9999;
}

/* 4a. LEFT EDGE OVERRIDE */
[data_tooltip_align="left"]::after {
    left: 0; 
    right: auto;
    transform: none; 
    margin-left: 10px; 
}

/* 4b. RIGHT EDGE OVERRIDE */
[data_tooltip_align="right"]::after {
    right: 0; 
    left: auto;
    transform: none; 
    margin-left: 0; 
    margin-right: 10px; 
}

/* 5. ON HOVER — animate in (Fade only) */
[data_tooltip]:hover::after {
    opacity: 1;
    transition-delay: 0.5s !important;
}

/* Add this to your existing CSS */
[data_tooltip].tooltip-hidden:hover::after {
    opacity: 0 !important;
    transition-delay: 0s !important;
}

/* 5. Tooltip visibility on hover */
/* [data_tooltip]:hover::after,
[data_tooltip]:hover::before {
    opacity: 1;
} */
 
/* Arrow — ALSO always created */
/* [data_tooltip]::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;

    transform: translateX(-50%); 
    
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #ed4801;
    opacity: 0;

    transition: opacity 0.2s; 
    transition-delay: 0s;
    z-index: 9999;
} */

/* Floating Sidebar for Map Page */
.map-sidebar {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 300px;
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #ed4801;
    z-index: 1000; /* Sit on top of map */
    color: white;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.back-btn {
    display: inline-block;
    color: #ccc;
    text-decoration: none;
    margin-bottom: 15px;
    font-size: 0.9em;
    transition: color 0.2s;
}
.back-btn:hover { color: #ed4801; }

.stat-item {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #aaa;
}
.stat-highlight {
    color: white; 
    font-weight: bold; 
    font-size: 1.1rem;
}

.profile-container {
    position: relative;
    margin-left: 10px;
    height: 35px;
}
.profile-icon {
    width: 35px;
    height: 35px;
    background: #ed4801; /* Orange profile background */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.profile-icon:hover {
    box-shadow: 0 0 0 4px rgba(237, 72, 1, 0.3);
}

/* Dropdown Menu Box */
.profile-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    width: 250px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 15px;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
}
.profile-dropdown.hidden {
    display: none;
}

/* Dropdown Header Info */
.profile-info-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 10px;
}
.profile-icon-large {
    width: 50px;
    height: 50px;
    background: #ff7e42;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8em;
    margin-bottom: 8px;
}
.dropdown-username {
    font-weight: bold;
    color: white;
    font-size: 1.1em;
}

/* Logout Button */
.dropdown-separator {
    border: none;
    border-top: 1px solid #333;
    margin: 10px 0;
}
.dropdown-logout-btn {
    width: 100%;
    background: #ed4801;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (max-width: 1200px) {

    /* Target the container holding the Verify/Resolve/Post buttons */
    .detail-header-r .action-buttons {
        /* Change the direction to vertical stacking */
        flex-direction: column; 
        
        /* Ensure buttons stretch to full width of the container */
        align-items: stretch; 
        
        /* Add gap for visual separation */
        gap: 8px; 
    }
    
    /* Ensure the detail redirect link (Post button) also behaves like a block button */
    .detail-redirect {
        justify-content: center; /* Center the text/icon in the full-width button */
    }
    
    /* Ensure the action buttons themselves stretch */
    .action-btn1 {
        width: 100%; /* Ensure the buttons take full width */
    }
}

/* style.css (Add these new selectors) */

.alert-popup {
    /* Position the box: Fixed allows it to float with scrolling */
    position: fixed; 
    top: 70px; /* Just below the 60px high header + 10px margin */
    right: 20px;
    
    /* Appearance */
    background: #ed4801; /* ALISTO Primary Color */
    color: white;
    padding: 15px 25px;
    border-radius: 10px; /* Rounded corners */
    
    /* Layout */
    display: flex;
    align-items: center;
    gap: 12px;
    
    /* Shadow and Stacking */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    
    /* Animation Control */
    opacity: 0;
    transform: translateX(100%); /* Start off-screen to the right */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.alert-popup.visible {
    opacity: 1;
    transform: translateX(0); /* Slide into view */
}

/* Ensure the initial hidden state prevents any display issues */
.hidden {
    display: none !important;
}
/* NOTE: You may need to remove 'display: none !important' from your existing 
   .hidden CSS class in style.css if you want to rely only on the opacity/transform 
   for the initial state, but for robust functionality, we often keep 'display: none'
   for the .hidden state and only remove it for the sliding animation to work. 
   We'll use a .visible class to trigger the animation. */