/* ==========================================================================
   Statistics Hub Page Styles
   ========================================================================== */

/* Main Card Style for each section */
.stats-card {
    background-color: #ffffff;
    border-radius: var(--border-radius, 0.75rem);
    border: 1px solid var(--border-color-light, #e9ecef);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.stats-card-header {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark, #003d99);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color-light, #e9ecef);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Comparison Tool */
.comparison-tool {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}
.comparison-tool p {
    color: var(--text-muted, #6c757d);
}

/* Charts Section */
.chart-container {
    padding: 1rem;
    border: 1px solid var(--border-color-light, #e9ecef);
    border-radius: var(--border-radius, 0.75rem);
    height: 100%;
}
.chart-title {
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted, #6c757d);
    margin-bottom: 1rem;
}

/* DataTables Customizations */
#stats-master-table_wrapper .dataTables_length,
#stats-master-table_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

#stats-master-table td a {
    color: rgb(13, 71, 161);
    font-weight: 500;
    text-decoration: none;
}
#stats-master-table td a:hover {
    text-decoration: underline;
}

/* Comparison Modal Table */
.comparison-table {
    text-align: center;
    width: 100%;
}
.comparison-table thead th {
    background-color: var(--primary-light, #f0f5ff);
    color: var(--primary-dark, #003d99);
    font-weight: 600;
}
.comparison-table tbody td:first-child {
    font-weight: 500;
    text-align: left;
}
.comparison-table th, .comparison-table td {
    white-space: nowrap;
}

/* ==========================================================================
   YOUR CUSTOM MODAL STYLES (from registration_rules.php)
   ========================================================================== */

/* Add the scrollbar variable to the root for access */
:root {
    --scrollbar-width: 17px; /* Default value */
}

body.modal-open {
    overflow: hidden !important;
    padding-right: var(--scrollbar-width); /* Use padding instead of margin for better layout stability */
}

.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    display: none; /* Controlled by JS */
}

.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1051;
}

.custom-modal-content {
    position: relative; /* Changed from fixed for better centering within a scrollable viewport */
    margin: 1.75rem auto; /* Top/bottom margin, auto centers horizontally */
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1052;
    width: 90%;
    max-width: 900px; /* Increased max-width for comparison table */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0; /* Prevents header from shrinking */
}

.custom-modal-body {
    overflow-y: auto; /* Allows only the body to scroll */
    flex-grow: 1; /* Allows body to take up available space */
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #6c757d;
}

.modal-close-btn:hover {
    color: #343a40;
}