/* =========================================
   1. GLOBAL & RESET
   ========================================= */
   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f8; /* Clean background for dashboard */
    height: 100vh;
    overflow: hidden; /* Prevents double scrollbars */
    color: #333;
}

.hidden {
    display: none !important;
}

/* =========================================
   2. AUTH SCREEN (Login/Register)
   ========================================= */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    width: 400px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.auth-box h1 {
    color: #667eea;
    margin-bottom: 20px;
}

.auth-box input, .auth-box textarea, .auth-box select {
    width: 100%;
    margin: 10px 0;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.3s;
    font-family: inherit;
    font-size: 1rem;
}

.auth-box input:focus, .auth-box select:focus, .auth-box textarea:focus {
    border-color: #667eea;
    outline: none;
}

.switch-text {
    margin-top: 15px;
    font-size: 0.9em;
    color: #666;
}

.switch-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

/* =========================================
   3. DASHBOARD LAYOUT (The 3-Column Grid)
   ========================================= */
.dashboard-container {
    display: grid;
    /* 260px Sidebar | Flexible Center | 320px Feed */
    grid-template-columns: 260px 1fr 320px; 
    height: 100vh;
}

/* --- Left Sidebar --- */
.sidebar-left {
    background: #1e293b;
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 10;
}

.profile-section {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #334155;
    padding-bottom: 20px;
}

.avatar { font-size: 3rem; margin-bottom: 10px; }
.badge { background: #3b82f6; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; }
.address-text { font-size: 0.8rem; color: #94a3b8; margin-top: 5px; }

.nav-menu { flex: 1; }

.nav-btn {
    background: none;
    border: none;
    color: #cbd5e1;
    width: 100%;
    text-align: left;
    padding: 15px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    border-radius: 8px;
    margin-bottom: 5px;
}

.nav-btn:hover, .nav-btn.active {
    background: #334155;
    color: white;
    transform: translateX(5px);
}

.logout { margin-top: auto; color: #ef4444; }
.logout:hover { background: rgba(239, 68, 68, 0.1); }

/* --- Main Content (Center) --- */
.main-content {
    padding: 30px;
    overflow-y: auto;
    background: #f4f6f8;
}

.main-content header h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

/* Map & Stats Styling */
.stats-cards {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.stat {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.stat h3 { color: #64748b; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }
.red-text { color: #ef4444; font-size: 2.5rem; font-weight: 800; margin: 10px 0 0 0; }
.yellow-text { color: #f59e0b; font-size: 2.5rem; font-weight: 800; margin: 10px 0 0 0; }

.map-placeholder {
    background: #e2e8f0;
    height: 450px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    border: 3px dashed #cbd5e1;
    color: #64748b;
}

/* --- Right Sidebar (Activity Feed) --- */
.sidebar-right {
    background: white;
    border-left: 1px solid #e2e8f0;
    padding: 20px;
    padding-bottom: 40px; /* To ensure the bottom button isn't cut off */
    display: block; /* Stops flexbox from forcing items to shrink */
    height: 100vh; /* Ensure it takes up the full screen height */
    overflow-y: auto; /* Enable a vertical scrollbar for the whole sidebar */
    overflow-x: hidden; /* Prevent horizontal scrolling */
    box-sizing: border-box; /* Include padding in height calculation */
}

/* Custom scrollbar styling for sidebar */
.sidebar-right::-webkit-scrollbar {
    width: 6px; /* Clean, thin scrollbar */
}

.sidebar-right::-webkit-scrollbar-track {
    background: #f1f5f9; /* Light gray background */
    border-radius: 3px;
}

.sidebar-right::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* Medium gray thumb */
    border-radius: 3px;
}

.sidebar-right::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; /* Darker on hover */
}

.sidebar-right h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
    margin-top: 20px;
}

/* =========================================
   NADMA Weather Widget Styles
   ========================================= */
.widget-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px; /* Ensure proper spacing between widgets */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.weather-widget {
    border-left: 4px solid #f59e0b; /* Orange alert border */
    background: #fffbf5; /* Light orange tint */
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.weather-header h4 {
    margin: 0;
    color: #1e293b;
    font-size: 1rem;
    font-weight: 600;
}

.live-badge {
    background: #ef4444;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.weather-content {
    text-align: center;
}

.weather-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    line-height: 1;
}

.weather-status {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.weather-details {
    display: flex;
    justify-content: space-around;
    font-size: 0.9rem;
    color: #64748b;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.weather-details span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Community Notices Widget */
.community-notices {
    border-left: 4px solid #667eea; /* Purple border */
    background: #f8fafc;
}

.events-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
}

.events-list li {
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.events-list li:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.events-list li:last-child {
    margin-bottom: 0;
}

.event-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.event-date {
    font-size: 0.8rem;
    color: #f59e0b;
    font-weight: 600;
    margin-bottom: 3px;
}

.event-location {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 5px;
}

.event-description {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.4;
    margin-top: 8px;
}

.activity-feed {
    height: auto; /* Ensure it always takes up space and expands as needed */
    min-height: 100px; /* Minimum height to ensure it's visible */
    padding-right: 5px; /* Space for scrollbar */
    /* Removed flex: 1 and overflow-y: auto to prevent double scrollbars */
}

/* Incident Items in Feed */
.incident-item {
    background: #f8fafc;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.incident-item:hover {
    transform: translateY(-2px);
    background: #f1f5f9;
}

.incident-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.incident-item h3 {
    margin: 0;
    font-size: 1rem;
    color: #475569;
}

.status-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    text-transform: uppercase;
}
/* Specific Badge Colors */
.status-pending .status-badge { background: #fef3c7; color: #d97706; }
.status-critical .status-badge { background: #fee2e2; color: #dc2626; }
.status-resolved .status-badge { background: #dcfce7; color: #16a34a; }

.incident-desc { font-size: 0.9rem; color: #64748b; margin-bottom: 10px; line-height: 1.4; }
.incident-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: #94a3b8; }

/* =========================================
   4. BUTTONS & INTERACTIVE ELEMENTS
   ========================================= */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    width: 100%;
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: #10b981;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
}

.btn-small {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 8px;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    color: #475569;
    flex-shrink: 0; /* Prevent button from shrinking */
}
.btn-small:hover { background: #e2e8f0; }

/* SOS BUTTON (With your Pulse Animation) */
.btn-sos {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: white;
    font-size: 1.2rem;
    padding: 20px;
    width: 100%;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.btn-sos:hover {
    transform: scale(1.02);
    animation: none;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 65, 108, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0); }
}

/* =========================================
   5. TOAST NOTIFICATIONS
   ========================================= */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transform: translateX(200%); /* Hidden off screen */
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.toast.show { transform: translateX(0); }
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }

/* =========================================
   6. CLEAN FORM STYLES (THIS IS THE NEW PART)
   ========================================= */
.report-container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
}

.report-header h2 { margin: 0 0 5px 0; color: #1e293b; font-size: 1.5rem; }
.report-header p { color: #64748b; margin-bottom: 25px; }

/* Side-by-Side Layout */
.split-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.report-container input,
.report-container select,
.report-container textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #f8fafc;
    font-family: inherit;
}

.report-container input:focus,
.report-container select:focus,
.report-container textarea:focus {
    background-color: white;
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* SOS Section */
.sos-container {
    background-color: #fef2f2;
    border: 2px dashed #f87171;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
}

.sos-container h3 { color: #b91c1c; margin-bottom: 5px; }
.sos-container p { color: #ef4444; margin-bottom: 15px; }

/* =========================================
   7. DATA TABLE STYLES (Household Records)
   ========================================= */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-table thead {
    background: #f1f5f9; /* Light gray background for header */
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: #f8fafc;
    transition: background 0.2s;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Action Buttons in Table */
.action-buttons {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.btn-edit {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-edit:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-delete {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* =========================================
   8. MODAL STYLES (Edit User Modal)
   ========================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Dark overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* High z-index to appear above everything */
    backdrop-filter: blur(4px); /* Blur effect behind modal */
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.modal-content form {
    padding: 20px;
}

.modal-content .input-group {
    margin-bottom: 15px;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #f8fafc;
    font-family: inherit;
    box-sizing: border-box;
}

.modal-content input:focus,
.modal-content textarea:focus {
    background-color: white;
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.modal-actions .btn-secondary {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.modal-actions .btn-secondary:hover {
    background: #5a6268;
}

.modal-actions .btn-primary {
    padding: 10px 20px;
}

/* =========================================
   9. RESPONSIVE DESIGN (Mobile)
   ========================================= */
@media (max-width: 900px) {
    .dashboard-container {
        grid-template-columns: 1fr; /* Stack everything */
        height: auto;
    }
    .split-row { flex-direction: column; }
    .sidebar-left, .sidebar-right {
        height: auto;
        padding: 15px;
    }
    .map-placeholder { height: 250px; }
    
    /* Make table scrollable on mobile */
    .data-table {
        display: block;
        overflow-x: auto;
    }
}