/* CamiKNOW Frontend Responsive & Layout Fixes */

/* 1. Global Chart & Canvas Responsiveness */
.analytics {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 2rem;
}

.analytics canvas {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block;
    box-sizing: border-box;
}

/* Specific chart sizing constraints */
#road_crashes,
#amicable,
#investigation,
#trafficViolation {
    max-height: 320px;
}

#time {
    width: 100% !important;
    max-width: 100% !important;
    height: 250px !important;
}

#week {
    width: 100% !important;
    max-width: 100% !important;
    height: 200px !important;
}

/* 2. Unified Global Filters System across ALL sections */
.global-filters {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    margin-bottom: 1.25rem !important;
}

.global-filters p,
.global-filters > p,
.filter p {
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #0f172a !important; /* Deep dark navy */
    color: #ffffff !important;           /* Crisp white text */
    font-size: 0.88rem !important;        /* Unified font size */
    font-weight: 700 !important;
    letter-spacing: 0.4px !important;
    padding: 0.45rem 1.15rem !important;
    border-radius: 8px !important;       /* Unified round corners */
    line-height: 1.4 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    white-space: nowrap !important;
}

.global-filters select,
.filter select {
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 0.45rem 2.2rem 0.45rem 1rem !important;
    border-radius: 8px !important;       /* Matching unified round corners */
    border: 1px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    color: #1e293b !important;           /* Slate text color */
    font-size: 0.88rem !important;        /* Unified font size matching label */
    font-weight: 600 !important;
    cursor: pointer !important;
    line-height: 1.4 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    white-space: nowrap !important;
}

.global-filters select:hover,
.filter select:hover {
    border-color: #3b82f6 !important;
}

.global-filters select:focus,
.filter select:focus {
    outline: none !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

/* Hero Section Year Filter: Transparent Background & White Text */
.hero_top_bar .select_input,
.select_input {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    background: rgba(15, 23, 42, 0.72) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 9999px !important;
    padding: 0.4rem 1rem 0.4rem 0.8rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

.hero_top_bar .select_input span,
.select_input span {
    color: #38bdf8 !important;
    font-size: 1.35rem !important;
    display: inline-flex !important;
    align-items: center !important;
}

.hero_top_bar .select_input select,
.select_input select,
#yearpicker1 {
    background: transparent !important;
    background-color: transparent !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.5px !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 2px 6px !important;
    cursor: pointer !important;
    color-scheme: dark !important;
}

.hero_top_bar .select_input select:focus,
.select_input select:focus,
#yearpicker1:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.hero_top_bar .select_input select option,
.select_input select option,
#yearpicker1 option {
    background-color: #0f172a !important;
    color: #ffffff !important;
}

/* =========================================================
   CRASH STATISTICS DASHBOARD COMPONENTS (SPECS 1, 2, 3, 4)
   ========================================================= */

/* Spec 1: Left Column — Image Banner */
.slides_data_box {
    position: relative !important;
    border-radius: 14px !important; /* rounded-xl / 14px */
    overflow: hidden !important;     /* overflow-hidden */
    width: 100% !important;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.12);
}

.slides_data_box .slides_data {
    border-radius: 14px !important;
    overflow: hidden !important;
    margin: 0 !important;
    height: calc(232rem / 16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(100rem / 16);
    font-weight: 700;
    color: #ffffff;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.slides_data_box .incident-badge {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    background-color: rgba(15, 23, 42, 0.75) !important; /* bg-slate-900/75 */
    color: #ffffff !important;
    font-size: 10px !important;                           /* ~10px font */
    font-weight: 700 !important;                          /* bold */
    text-transform: uppercase !important;                 /* uppercase */
    letter-spacing: 0.6px !important;
    padding: 0.25rem 0.625rem !important;                 /* py-1 px-2.5 */
    border-radius: 9999px !important;                     /* rounded-full */
    z-index: 2 !important;
    line-height: 1.2 !important;
    pointer-events: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Spec 2: Left Column — Description Box (bg-white border border-slate-200 rounded-xl p-4) */
.slides_desc {
    background-color: #ffffff !important; /* bg-white */
    border: 1px solid #e2e8f0 !important; /* border border-slate-200 */
    border-radius: 0.75rem !important;    /* rounded-xl (12px) */
    padding: 1rem !important;             /* p-4 (16px) */
    color: #475569 !important;            /* text-slate-600 */
    font-size: 0.92rem !important;
    line-height: 1.55 !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03) !important;
    margin-top: 0.75rem !important;
    box-sizing: border-box !important;
}

/* Spec 3: Right Column — Panel Container (bg-white border border-slate-200 rounded-2xl p-6 shadow-sm) */
.slides_chart {
    background-color: #ffffff !important;                                    /* bg-white */
    border: 1px solid #e2e8f0 !important;                                    /* border border-slate-200 */
    border-radius: 1rem !important;                                          /* rounded-2xl (16px) */
    padding: 1.5rem !important;                                              /* p-6 (24px) */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05) !important; /* shadow-sm */
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    overflow: hidden !important;
}

/* Spec 4: Right Column — Donut Chart & Legend */
.slide-doughnut {
    position: relative !important;
    width: 100% !important;
    max-width: 320px !important;
    height: 220px !important;
    margin: 0.5rem auto 0.75rem auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.slide-doughnut canvas {
    width: 100% !important;
    max-width: 320px !important;
    height: 220px !important;
}

/* Strictly hide inactive chart canvases */
.slide-doughnut canvas.chart-hidden,
.slide-doughnut canvas[style*="display: none"],
.slide-doughnut canvas[style*="display:none"] {
    display: none !important;
    visibility: hidden !important;
}

.slide-doughnut canvas.chart-active {
    display: block !important;
    visibility: visible !important;
}

/* Strictly uniform center icon sizing & alignment across all donut charts */
.slide-doughnut span,
.slide-doughnut .material-symbols-sharp,
.day_and_night .slide-doughnut span,
.day_and_night .progress_section .slide-doughnut span {
    position: absolute !important;
    top: 40% !important; /* Exact vertical center of the donut ring */
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 28px !important;
    line-height: 28px !important;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 28 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    color: #64748b !important;
    pointer-events: none !important;
    z-index: 10 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Tabs: Culpable / Victim (Top) */
.slide_chart_title {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 0.75rem !important;
    padding-block: 0 !important;
}

.slide_chart_title a {
    color: #475569 !important;
    background-color: #f1f5f9 !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    padding: 0.4rem 1.25rem !important;
    border-radius: 9999px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

.slide_chart_title a.active,
.slide_chart_title a:hover {
    color: #ffffff !important;
    background-color: #2563eb !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3) !important;
}

/* Tabs: Sex / Age / Roles (Bottom) */
.slide_chart_nav {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1.5rem !important;
    width: 100% !important;
    margin-top: 0.5rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0 !important;
    border-top: 1px solid #f1f5f9 !important;
}

.slide_chart_nav a {
    color: #64748b !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    padding: 0.25rem 0.5rem !important;
    border-bottom: 2px solid transparent !important;
    transition: all 0.2s ease !important;
}

.slide_chart_nav a.active,
.slide_chart_nav a:hover {
    color: #2563eb !important;
    border-bottom: 2px solid #2563eb !important;
}

/* 5. Mobile Navigation & Viewport Adjustments */
@media screen and (max-width: 768px) {
    .header-inner-container {
        padding-inline: 1rem !important;
    }

    .hero_container {
        padding: 1rem 0.5rem;
    }

    .hero_top_bar {
        justify-content: center !important;
        margin-bottom: 1rem;
    }

    .day_and_night {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .progress_section {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 1.5rem;
    }

    .doughnut {
        max-width: 100% !important;
    }

    #map-wrapper {
        height: 50vh !important;
        min-height: 360px !important;
    }

    .map-legend {
        bottom: 12px !important;
        left: 12px !important;
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
    }

    .map-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0;
    }
}
