/* ======================= General Setup & Variables ======================= */
:root {
    --primary-color: #005A9C; /* Deep Blue */
    --secondary-color: #FFFFFF; /* White */
    --accent-color: #FFC107; /* Warning Yellow/Gold */
    --text-dark: #212529;
    --text-light: #f8f9fa;
    --section-bg: #f8f9fa;
    --font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
}

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


body {
    font-family: var(--font-family);
    color: var(--text-dark);
    line-height: 1.6;
    padding-top: 80px; /* Account for fixed header height */
}

.section-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    color: var(--primary-color);
}

/* ======================= Header & Navigation ======================= */
.main-header {
    background-color: var(--secondary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    min-height: 60px; /* Ensures consistent header height */
    max-width: 100%;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
    flex-shrink: 0; /* Prevents menu from shrinking too much */
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    white-space: nowrap; /* Prevents text from wrapping */
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0; /* Prevents the buttons from shrinking */
}

/* ======================= Buttons & Links ======================= */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn--primary {
    background-color: var(--accent-color);
    color: var(--text-dark);
}

.btn--primary:hover {
    background-color: #e0a800;
}

.btn--secondary {
    background-color: var(--primary-color);
    color: var(--secondary-color);
}

.btn--secondary:hover {
    background-color: #004a80;
}

.btn--large {
    font-size: 1.2rem;
    padding: 1rem 2rem;
}

.link-cta {
    color: var(--secondary-color);
    text-decoration: underline;
    margin-left: 1rem;
}

/* ======================= Footer ======================= */
.main-footer {
    background: linear-gradient(135deg, #212529, #343a40);
    color: var(--text-light);
    padding: 3rem 5% 1rem 5%;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: #e0a800;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 1rem;
    color: #adb5bd;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #e0a800;
}

.footer-social {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.footer-social a {
    color: #adb5bd;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.footer-social a:hover {
    color: #e0a800;
}

.contact-info p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #adb5bd;
}

.contact-info i {
    color: #e0a800;
    width: 20px;
}

.footer-logos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-top: 1px solid #495057;
    border-bottom: 1px solid #495057;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.govt-logos {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    color: #e0a800;
}

.govt-logos img {
    width: 40px;
    height: 40px;
}

.footer-certifications {
    font-size: 0.9rem;
    color: #adb5bd;
}

.footer-bottom {
    text-align: center;
}

.footer-links {
    margin-bottom: 1rem;
}

.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    margin: 0 0.5rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #e0a800;
}

.footer-bottom p {
    margin-bottom: 0.5rem;
    color: #adb5bd;
}

.footer-update {
    font-size: 0.85rem;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .footer-logos {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* ======================= Government Website Styles ======================= */

.govt-header {
    background: linear-gradient(135deg, #e0a800, #e0a800);
    color: white;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #e0a800;
}

.govt-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.govt-emblem {
    width: 40px;
    height: 40px;
}

.govt-info h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.govt-info p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.last-updated {
    font-size: 0.85rem;
    opacity: 0.9;
}

.govt-page-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-left: 4px solid #e0a800;
    padding: 2rem 5%;
}

.breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: #6c757d;
}

.breadcrumb a {
    color: #e0a800;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.page-description {
    font-size: 1.1rem;
    color: #495057;
    margin: 1rem 0 2rem 0;
}

.page-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-weight: 600;
    color: #e0a800;
}

/* ======================= Analytics Page Specific Styles ======================= */

/* Remove default page container padding for analytics page */
.page-container {
    padding-top: 0;
}

.filters-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1.5rem 5%;
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-top: 0;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-item label {
    font-weight: 600;
    color: #495057;
}

.filter-item input[type="date"],
.filter-item select {
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.filter-item input[type="date"]:focus,
.filter-item select:focus {
    outline: none;
    border-color: #e0a800;
    box-shadow: 0 0 0 3px rgba(224, 168, 0, 0.1);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    padding: 2rem 5%;
    background-color: #f8f9fa;
    max-width: 1200px;
    margin: 0 auto;
}

.kpi-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e9ecef;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.kpi-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.kpi-header i {
    font-size: 1.25rem;
    width: 30px;
    text-align: center;
}

.kpi-header i { color: #6c757d; }

.kpi-category {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 3rem;
    font-weight: 700;
    color: #212529;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.kpi-label {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.kpi-trend.positive { color: #28a745; }
.kpi-trend.negative { color: #dc3545; }
.kpi-trend.neutral { color: #6c757d; }

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    padding: 2rem 5%;
}

.chart-container {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    position: relative;
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-dark);
    flex-shrink: 0;
}

/* Canvas containment for charts */
.chart-container canvas {
    flex: 1;
    max-width: 100%;
    max-height: calc(100% - 60px);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Ensure chart.js responsive behavior */
.chart-container .chartjs-render-monitor {
    width: 100% !important;
    height: 100% !important;
    max-height: calc(100% - 60px) !important;
}

.map-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    background-color: #e9ecef;
    border-radius: 8px;
    color: #6c757d;
    position: relative;
    overflow: hidden;
    min-height: 250px;
    max-height: 100%;
}

.map-placeholder i {
    font-size: 4rem;
    margin-top: 1rem;
    opacity: 0.6;
}

.map-placeholder p {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    text-align: center;
}

/* Responsive design for charts */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        padding: 1rem 3%;
    }
    
    .chart-container {
        height: 350px;
        padding: 1rem;
    }
    
    .chart-container h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .map-placeholder {
        min-height: 200px;
    }
    
    .map-placeholder i {
        font-size: 3rem;
    }
}

/* ======================= Authority Analytics Specific Styles ======================= */

/* Charts Section */
.charts-section {
    padding: 2rem 5%;
    background-color: #fff;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.charts-row .chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--section-bg);
}

.chart-header h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 0;
}

.chart-controls select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: 400px;
}

.chart-container canvas {
    max-height: 300px;
}

/* Performance Metrics */
.performance-section {
    padding: 2rem 5%;
    background-color: var(--section-bg);
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--section-bg);
}

.metric-header h4 {
    color: var(--primary-color);
    margin: 0;
}

.metric-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-good {
    color: #28a745;
}

.metric-details p {
    margin: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-details span {
    font-weight: 600;
    color: var(--primary-color);
}

/* Section Controls */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.section-controls select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: var(--text-dark);
}

/* Enhanced Status and Urgency Badges */
.urgency-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.urgency-high {
    background-color: #dc3545;
    color: white;
}

.urgency-medium {
    background-color: var(--accent-color);
    color: var(--text-dark);
}

.urgency-low {
    background-color: #17a2b8;
    color: white;
}

.hazard-type {
    text-transform: capitalize;
    font-weight: 500;
}

.location-text {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Action Buttons */
.btn-action {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    margin: 0 0.25rem;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.btn-action:hover {
    background-color: var(--section-bg);
}

/* Authority Notice */
.authority-notice {
    text-align: center;
    padding: 2rem;
    background-color: var(--section-bg);
    border-radius: 8px;
    border: 1px solid #ddd;
}

.authority-notice i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.authority-notice p {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.1rem;
}

/* Responsive Design for Authority Analytics */
@media (max-width: 1200px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .section-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .chart-container {
        height: 350px;
        padding: 1rem;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
}

/* ======================= Responsive Design ======================= */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: nowrap;
        padding: 0.5rem 3%;
    }
    
    .nav-menu {
        gap: 1rem;
    }
    
    .nav-actions {
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* ======================= Authority Analytics Missing Styles ======================= */

/* Loading States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: white;
    margin: 2rem 5%;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-container p {
    color: var(--text-dark);
    font-size: 1.1rem;
    margin: 0;
}

/* Error States */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: white;
    margin: 2rem 5%;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #dc3545;
}

.error-content {
    max-width: 400px;
}

.error-content i {
    font-size: 3rem;
    color: #dc3545;
    margin-bottom: 1rem;
}

.error-content h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.error-content p {
    color: #666;
    margin-bottom: 2rem;
}

/* Overview Section */
.overview-section {
    padding: 2rem 5%;
    background-color: var(--section-bg);
}

.overview-section h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-size: 2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-card.primary {
    border-left: 4px solid var(--primary-color);
}

.stat-card.warning {
    border-left: 4px solid var(--accent-color);
}

.stat-card.success {
    border-left: 4px solid #28a745;
}

.stat-card.danger {
    border-left: 4px solid #dc3545;
}

.stat-card.info {
    border-left: 4px solid #17a2b8;
}

.stat-card.secondary {
    border-left: 4px solid #6c757d;
}

.stat-icon {
    padding: 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 60px;
}

.stat-card.primary .stat-icon {
    background: rgba(0, 90, 156, 0.1);
    color: var(--primary-color);
}

.stat-card.warning .stat-icon {
    background: rgba(255, 193, 7, 0.1);
    color: var(--accent-color);
}

.stat-card.success .stat-icon {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.stat-card.danger .stat-icon {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.stat-card.info .stat-icon {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
}

.stat-card.secondary .stat-icon {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.stat-icon i {
    font-size: 1.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 0.25rem 0;
    line-height: 1;
}

.stat-content p {
    color: #666;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Analytics Main Container */
.analytics-main {
    min-height: calc(100vh - 80px);
    background-color: var(--section-bg);
}

/* Government Header Enhancements */
.govt-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004080 100%);
    color: white;
    padding: 1rem 5%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.govt-branding {
    display: flex;
    align-items: center;
    justify-content: center;
}

.govt-info h1 {
    font-size: 1.8rem;
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.govt-info p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Last Updated Indicator */
.last-updated {
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.last-updated i {
    margin-right: 0.5rem;
    opacity: 0.8;
}

/* Responsive adjustments for authority analytics */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        min-width: 50px;
        height: 50px;
        padding: 0.75rem;
    }
    
    .stat-icon i {
        font-size: 1.25rem;
    }
    
    .stat-content h3 {
        font-size: 1.5rem;
    }
    
    .loading-container,
    .error-container {
        margin: 1rem;
        padding: 2rem 1rem;
    }
    
    .overview-section {
        padding: 1rem;
    }
    
    .overview-section h2 {
        font-size: 1.5rem;
    }
}
