/* ==========================================================================
   1. VARIABLES & CORE STYLES
   ========================================================================== */
:root {
    --bg-page: #f4f7f6;
    --white: #ffffff;
    --accent: #2563eb;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;

    --primary-color: #2364aa;
    --primary-yellow: #fec601;
    --primary-orange: #ea7317;
    --secondary-blue: #3da5d9;
    --third-blue: #73bfb8;
    --primary-red: #e63946;
    --primary-white: #f8f9fa;
}

.show-flex{
    display: flex !important;
}

/* ==========================================================================
   2. MODAL MECHANICS & LAYOUT
   ========================================================================== */
.analytics-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: none; 

    justify-content: center;
    align-items: center;
}

.analytics-modal-container {
    background: var(--primary-white);
    width: 95%;
    max-width: 1300px;
    height: 90vh;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden; 
    display: flex;
    flex-direction: column;
    margin: auto;
}

/* Modal Header Layout */
.analytics-modal-header {
    background: var(--primary-white);
    padding: 20px 30px;
    border-bottom: 1px solid var(--primary-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title { 
    margin: 0; 
    font-size: 1.5rem; 
    color: #111827; 
}

.modal-subtitle { 
    margin: 0; 
    font-size: 0.9rem; 
    color: var(--text-light); 
}

.close-modal-btn {
    background: var(--primary-white);
    border: none;
    font-size: 2rem;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover { 
    background: var(--primary-white); 
    color: var(--primary-red); 
}

/* Main Inner Wrapper (Handles scrolling inside the modal) */
.analytics-wrapper {
    padding: 30px;
    background-color: var(--primary-white);
    overflow-y: auto;
    flex-grow: 1;
}

/* ==========================================================================
   3. SUMMARY CARDS LAYOUT
   ========================================================================== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px; 
}

.metric-card-box {
    background: var(--primary-white);
    border-radius: 15px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--primary-white);
    transition: transform 0.2s ease;
}

.metric-card-box:hover {
    transform: translateY(-5px);
}

/* Upper Part: Icon and Text */
.metric-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.metric-icon {
    font-size: 1.8rem;
    background: var(--primary-white);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.metric-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Bottom Part: The Big Number */
.metric-bottom {
    margin-top: 20px;
}

.count-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: #1a202c;
    line-height: 1;
}

/* Color Themes for Cards */
.girl-theme .metric-icon { background: var(--primary-white); }
.girl-theme .count-number { color: var(--primary-red); } 

.boy-theme .metric-icon { background: var(--primary-white); }
.boy-theme .count-number { color: var(--primary-color); } 

/* ==========================================================================
   4. FILTER BAR
   ========================================================================== */
.filter-dock {
    background: var(--primary-white);
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 25px;
}

.filter-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-input-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
}

.filter-input-group select, 
.filter-input-group input {
    padding: 10px 14px;
    border: 1px solid var(--primary-white);
    border-radius: 8px;
    font-size: 0.95rem;
}

.age-inputs { 
    display: flex; 
    gap: 10px; 
}

.age-inputs input { 
    width: 80px; 
}

/* ==========================================================================
   5. DATA GRID & TABLE
   ========================================================================== */
.data-grid-container {
    background: var(--primary-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table th {
    text-align: left;
    padding: 16px;
    background: var(--primary-white);
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
}

.analytics-table td {
    padding: 16px;
    border-bottom: 1px solid var(--primary-white);
    color: var(--text-dark);
}

.church-tag {
    background: var(--primary-white);
    color: #4a5568;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.church-tag.other {
    background: var(--primary-white);
    color: #718096;
}

/* ==========================================================================
   6. UTILITY / GLOBAL CLASSES
   ========================================================================== */
.fw-bold { font-weight: 700; }
.text-muted { color: var(--text-light); }
.text-end { text-align: right; }

.empty-state { 
    padding: 50px; 
    text-align: center; 
    color: var(--text-light); 
}