/* --- Root Variables & Global Styles --- */
:root {
    --bg-color: #f8f9fa; 
    --card-bg: #ffffff; 
    --sidebar-bg: #ffffff;
    --primary-red: #BE5247; 
    --primary-green: #2BA680;
    --accent-red: #ef4444; 
    --accent-green: #10b981;
    --over-capacity-red: #B23427;
    --text-color: #212529;
    --text-light: #6B7280; 
    --text-lighter: #adb5bd;
    --border-color: #dee2e6; 
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --font-title: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; 
    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body { 
    font-family: var(--font-body); 
    background-color: var(--bg-color);
    color: var(--text-color); 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Main Layout --- */
.dashboard-layout { 
    display: flex; 
    min-height: 100vh;
}

.sidebar { 
    width: 260px; 
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    position: fixed; 
    transition: transform var(--transition-slow); 
    z-index: 200;
    box-shadow: none;
}

.main-content { 
    flex-grow: 1; 
    margin-left: 260px; 
    display: flex; 
    flex-direction: column; 
    background: transparent;
    min-height: 100vh;
}

/* --- Header --- */
.main-header { 
    display: flex; 
    align-items: center;
    padding: 1.75rem 1.5rem; 
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color); 
    position: sticky; 
    top: 0; 
    z-index: 100;
    transition: all var(--transition-base);
}

.header-titles { 
    margin-left: 1rem; 
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
}

.header-logo-main {
    height: 45px;
    transition: transform var(--transition-base);
}

.header-logo-main:hover {
    transform: scale(1.02);
}

.header-titles h1 { 
    font-family: var(--font-title); 
    font-size: 2rem; 
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-variant: small-caps;
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-toolbar { 
    margin-left: auto; 
    display: flex;
    align-items: center;
}

.header-logo { 
    height: 60px;
    transition: transform var(--transition-base);
}

.header-logo:hover {
    transform: scale(1.05);
}

.header-logo-desktop {
    display: none;
}

.header-logo-mobile {
    display: block;
}

.hamburger-icon {
    width: 24px;
    height: 24px;
}

.content-body { 
    padding: 2rem; 
    max-width: 1600px; 
    width: 100%; 
    margin: 0;
}

#content-subtitle { 
    display: none;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Sticky Category Banner --- */
.sticky-category-banner {
    position: sticky;
    top: calc(1.75rem + 1.75rem + 45px + 1px); /* Position below header (padding + padding + logo height + border) */
    z-index: 99;
    background: rgba(112, 112, 112, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem;
    transition: all var(--transition-base);
    height: calc((1.75rem + 1.75rem + 45px) / 3); /* 1/3 of main header height */
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}

.sticky-category-banner.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.sticky-category-banner.hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}

.sticky-category-text {
    font-family: var(--font-title);
    font-size: 0.875rem;
    font-weight: 700;
    color: #f8f9fa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Sidebar --- */
.sidebar-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 1.73rem 1.5rem;   
    border-bottom: 1px solid var(--border-color); 
    flex-shrink: 0;
}

.sidebar-logo-link {
    display: block;
    transition: transform var(--transition-base);
}

.sidebar-logo-link:hover {
    transform: scale(1.05);
}

.sidebar-logo {
    height: 40px;
}

.sidebar-nav { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 1.5rem 0;
}

.sidebar-footer { 
    padding: 1.5rem; 
    border-top: 1px solid var(--border-color); 
    font-size: 0.8rem; 
    color: var(--text-light); 
    flex-shrink: 0; 
    text-align: center;
}

.nav-view-selector { 
    display: flex; 
    padding: 0 1.5rem; 
    margin-bottom: 1.5rem; 
    gap: 0.75rem;
    padding-top: 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-view-link { 
    flex: 1; 
    text-align: center; 
    padding: 0.6rem 1rem; 
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-light); 
    text-decoration: none; 
    border-radius: 10px; 
    transition: all var(--transition-base);
    background-color: var(--bg-color); 
    border: 1px solid var(--border-color);
}

.nav-view-link:hover { 
    color: var(--primary-red); 
    border-color: var(--primary-red); 
    background-color: #fff;
}

.nav-view-link.active { 
    color: var(--primary-red); 
    border-color: var(--primary-red);
    background-color: #fff;
    box-shadow: var(--shadow-sm);
}

.nav-list-container { 
    display: none; 
}

.nav-list-container.active { 
    display: block; 
}

.nav-list-container:not(.active) {
    padding: 0 1.5rem;
}

/* --- New Filter Styles --- */
.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0 1.5rem 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-wrapper::after {
    content: '';
    background-image: url('public/icon/filter.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 0.875rem;
    height: 0.875rem;
    opacity: 0.6;
    /* Light grey color (var(--text-lighter) = #adb5bd) applied via CSS filter */
    filter: invert(76%) sepia(6%) saturate(273%) hue-rotate(169deg) brightness(92%) contrast(87%);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.filter-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background-color: #ffffff;
    border: none;
    border-radius: 12px;
    color: var(--text-color);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-select:hover {
    background-color: #fff;
    box-shadow: var(--shadow-sm);
}

.filter-select:focus {
    background-color: #fff;
    border: none;
    outline: none;
    box-shadow: 0 0 0 3px rgba(43, 166, 128, 0.2);
}

.filter-select option:hover {
    background-color: var(--primary-green);
    color: white;
}

.filter-select option:disabled {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
}

.custom-select-wrapper:has(.filter-select:focus)::after {
    opacity: 1;
    /* Keep the same filter, no rotation since it's not a chevron */
}

.category-separator {
    height: 1px;
    background: var(--border-color);
    margin: 0rem 1.5rem 1.5rem;
}

/* --- Search Controls (for Schools) --- */
.search-controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0 1.5rem 1.5rem;
}

.search-group {
    display: flex;
    flex-direction: column;
}

.search-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background-color: #ffffff;
    border: none;
    border-radius: 12px;
    color: var(--text-color);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-base);
}

.search-input::placeholder {
    color: var(--text-lighter);
}

.search-input:hover {
    background-color: #fff;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    background-color: #fff;
    border: none;
    outline: none;
    box-shadow: 0 0 0 3px rgba(43, 166, 128, 0.2);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.875rem;
    height: 0.875rem;
    pointer-events: none;
    transition: opacity var(--transition-base);
    opacity: 0.6;
}

.search-input:focus ~ .search-icon {
    opacity: 0.8;
}

.search-separator {
    height: 1px;
    background: var(--border-color);
    margin: 0rem 1.5rem 1.5rem;
}

.nav-list-item { 
    display: flex;
    align-items: center;
    text-decoration: none; 
    color: var(--text-light); 
    padding: 0.75rem 1.5rem;
    margin: 0.2rem 0;
    border-radius: 0;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-base);
    position: relative;
    border-left: 4px solid transparent;
}

.nav-list-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-red);
    border-left-color: var(--primary-red);
}

.nav-list-item.active { 
    background-color: var(--bg-color);
    color: var(--primary-red); 
    font-weight: 600;
    border-left-color: var(--primary-red);
}

/* --- ATOMIC CARD GRID --- */
.card-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    grid-auto-rows: 280px; 
    gap: 1.5rem;
}

.data-card { 
    background: var(--card-bg);
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-slow);
    opacity: 0; 
    animation: fadeInScale 0.5s ease forwards; 
    display: flex; 
    flex-direction: column;
    overflow: hidden;
}

@keyframes fadeInScale { 
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}

.data-card:hover { 
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-red);
}

.data-card.over-capacity { 
    border-color: var(--accent-red);
}

/* Tile size classes */
.data-card.tile-double-width { grid-column: span 2; }
.data-card.tile-double-height { grid-row: span 2; }
.data-card.tile-double-both { grid-column: span 2; grid-row: span 2; }

/* --- Card Flip Functionality --- */
.data-card[data-flippable="true"] {
    perspective: 1000px;
    transform-style: preserve-3d;
    position: relative;
}

.data-card[data-flippable="true"] .card-flip-container {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.data-card.flipped .card-flip-container {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
}

.card-face-front {
    z-index: 2;
    transform: rotateY(0deg);
}

.card-face-back {
    transform: rotateY(180deg);
    background: var(--card-bg);
}

/* Disable hover effect when card is flipped */
.data-card.flipped:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--border-color);
}

/* --- Card Back Face Styling --- */
.card-back-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.card-back-title-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
}

.card-back-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    flex-shrink: 0;
    filter: invert(47%) sepia(19%) saturate(1618%) hue-rotate(318deg) brightness(89%) contrast(83%);
}

.card-back-title {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.card-back-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    opacity: 0.6;
}

.card-back-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.card-back-close:focus {
    outline: none;
    opacity: 1;
}

.card-back-close-icon {
    width: 1rem;
    height: 1rem;
    /* Light grey color (var(--text-lighter) = #adb5bd) applied via CSS filter */
    filter: invert(76%) sepia(6%) saturate(273%) hue-rotate(169deg) brightness(92%) contrast(87%);
}

.card-back-close:hover .card-back-close-icon {
    /* Red color (var(--primary-red) = #BE5247) applied via CSS filter on hover */
    filter: invert(47%) sepia(19%) saturate(1618%) hue-rotate(318deg) brightness(89%) contrast(83%);
}

.card-back-content {
    padding: 1.5rem 1.25rem;
    color: var(--text-color);
    line-height: 1.6;
    font-size: 0.9rem;
    flex: 1;
    overflow-y: auto;
}

.card-back-content p {
    margin: 0 0 0.75rem 0;
    color: var(--text-light);
}

.card-back-content p:last-child {
    margin-bottom: 0;
}

.card-header { 
    display: flex; 
    align-items: center; 
    padding: 1rem 1.25rem; 
    border-bottom: 1px solid var(--border-color); 
    flex-shrink: 0;
}

.card-header-icon { 
    width: 20px; 
    height: 20px;
    margin-right: 0.75rem; 
    flex-shrink: 0;
}

.card-title { 
    font-family: var(--font-title); 
    font-size: 1rem; 
    font-weight: 600;
    color: var(--text-color);
    flex-grow: 1;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.warning-icon {
    margin-left: 0.5rem;
    width: 1.1rem;
    height: 1.1rem;
    vertical-align: middle;
}

.warning-icon-red {
    /* Red color #B23427 (var(--over-capacity-red)) applied via CSS filter */
    filter: invert(27%) sepia(55%) saturate(1258%) hue-rotate(338deg) brightness(93%) contrast(87%);
}

.warning-icon-yellow {
    /* Yellow color #f59e0b applied via CSS filter */
    filter: invert(68%) sepia(77%) saturate(2181%) hue-rotate(0deg) brightness(101%) contrast(95%);
}

.card-nav-icon {
    margin-left: auto;
    width: 1rem;
    height: 1rem;
    opacity: 0.6;
    cursor: pointer;
    transition: all var(--transition-base);
    /* Light grey color (var(--text-lighter) = #adb5bd) applied via CSS filter */
    filter: invert(76%) sepia(6%) saturate(273%) hue-rotate(169deg) brightness(92%) contrast(87%);
}

.card-nav-icon:hover {
    opacity: 1;
    transform: scale(1.1);
    /* Red color (var(--primary-red) = #BE5247) applied via CSS filter on hover */
    filter: invert(47%) sepia(19%) saturate(1618%) hue-rotate(318deg) brightness(89%) contrast(83%);
}

.card-body { 
    padding: 1.25rem; 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column;
}

/* School Header Card */
.school-header-card .card-body { 
    padding: 0; 
    position: relative;
    overflow: hidden;
}

.school-header-card img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.school-header-card:hover img {
    transform: scale(1.05);
}

.school-header-card .school-name-title { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
    color: white; 
    padding: 2rem 1.25rem 1.25rem; 
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Photo Credit */
.photo-credit {
    position: absolute;
    bottom: 0.25rem;
    right: 0.25rem;
    color: white;
    font-size: 0.5rem;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Stat Card */
.stat-card .card-body { 
    align-items: center; 
    justify-content: center; 
    text-align: center;
    position: relative;
    /* Add bottom padding for cards with info icons to prevent overlap
       3.5rem provides adequate space for stat-value, stat-label, and info icon */
    padding-bottom: 3.5rem;
}

.stat-value { 
    font-family: var(--font-title); 
    font-size: 3rem; 
    font-weight: 700;
    color: var(--primary-red);
    line-height: 1;
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.stat-label { 
    font-weight: 500;
    font-size: 0.9rem; 
    margin-top: 0.5rem; 
    color: var(--text-light);
}

/* Base footnote style shared across all footnotes */
.enrolment-footnote,
.capacity-footnote {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    color: var(--text-lighter);
    font-weight: 400;
    text-align: right;
}

/* Tile footnotes for list cards (projects_local, accessibility) */
/* Use left and right positioning for proper width in list cards */
.tile-footnote {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    color: var(--text-lighter);
    font-weight: 400;
    text-align: right;
}

/* Static footnote for projects_local - not sticky, flows with content */
.tile-footnote-static {
    margin-top: 1rem;
    padding-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-lighter);
    font-weight: 400;
    text-align: right;
    border-top: 1px solid var(--border-color);
}

/* Footnote link styling */
.footnote-link {
    color: var(--text-lighter);
    text-decoration: underline;
    transition: color var(--transition-base);
}

.footnote-link:hover {
    color: var(--primary-red);
}

.footnote-link:visited {
    color: var(--text-lighter);
}

.over-capacity .stat-value { 
    color: var(--over-capacity-red);
}

/* Utilization Card */
.utilization-card .card-body { 
    justify-content: center;
    align-items: center;
    /* Add bottom padding to provide adequate space below progress bar
       2rem is sufficient for utilization cards (smaller vertical content than stat-cards) */
    padding-bottom: 2rem;
}

.utilization-card.yellow-zone .card-body {
    background-color: rgba(245, 158, 11, 0.1);
    border-radius: 0 0 12px 12px;
}

.utilization-card.over-capacity .card-body {
    background-color: rgba(178, 52, 39, 0.1);
    border-radius: 0 0 12px 12px;
}

/* Ensure stat-card has sufficient minimum height
   200px accommodates large stat-value (3rem font), stat-label, and info icon */
.stat-card {
    min-height: 200px;
}

/* Ensure utilization-card has sufficient minimum height  
   180px accommodates percentage value and progress bar (less vertical content than stat-card) */
.utilization-card {
    min-height: 180px;
}

.progress-bar-container { 
    width: 100%; 
    height: 12px; 
    background-color: var(--bg-color);
    border-radius: 100px; 
    overflow: hidden; 
    margin-top: 1rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-bar-fill { 
    height: 100%; 
    background: var(--primary-green);
    border-radius: 100px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.yellow-zone .progress-bar-fill,
.progress-bar-fill.yellow-zone {
    background: #f59e0b;
}

.over-capacity .progress-bar-fill,
.progress-bar-fill.over-capacity { 
    background: var(--over-capacity-red);
}

/* Stats Combined Card */
.stats-combined-card .card-body {
    padding: 1rem;
}

.stats-rows {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.stat-row {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    transition: all var(--transition-base);
}

.stat-row:hover {
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.stat-row.yellow-zone {
    background-color: rgba(245, 158, 11, 0.1);
}

.stat-row.over-capacity {
    background-color: rgba(178, 52, 39, 0.1);
}

.stat-row-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-row-value {
    font-family: var(--font-title);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-red);
    line-height: 1;
}

.stat-row.yellow-zone .stat-row-value {
    color: #f59e0b;
}

.stat-row.over-capacity .stat-row-value {
    color: var(--over-capacity-red);
}

.stat-row .progress-bar-container {
    width: 100%;
    height: 8px;
    margin-top: 0.75rem;
}

.stat-row .progress-bar-fill.yellow-zone {
    background: #f59e0b;
}

.stat-row .progress-bar-fill.over-capacity {
    background: var(--over-capacity-red);
}

/* Legacy stats-grid styles for backwards compatibility */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto auto;
    gap: 1rem;
    height: 100%;
}

.stats-grid .stat-item:nth-child(3) {
    grid-column: 1 / -1;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    transition: all var(--transition-base);
}

.stat-item:hover {
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.stat-item.yellow-zone {
    background-color: rgba(245, 158, 11, 0.1);
}

.stat-item.over-capacity {
    background-color: rgba(178, 52, 39, 0.1);
}

.stat-item-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.stat-item-value {
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-red);
    line-height: 1;
}

.stat-item.yellow-zone .stat-item-value {
    color: #f59e0b;
}

.stat-item.over-capacity .stat-item-value {
    color: var(--over-capacity-red);
}

.stat-item .progress-bar-container {
    width: 100%;
    height: 8px;
    margin-top: 0.75rem;
}

.stat-item .progress-bar-fill.yellow-zone {
    background: #f59e0b;
}

.stat-item .progress-bar-fill.over-capacity {
    background: var(--over-capacity-red);
}

/* Reduce font size for utilization value in stats grid */
.stats-grid .stat-item:nth-child(3) .stat-item-value {
    font-size: 1.75rem;
}

/* Chart Card */
.chart-card .card-body { 
    padding: 1rem;
}

.chart-container { 
    position: relative; 
    width: 100%; 
    flex-grow: 1;
}

/* List Card */
/* Desktop: min-height ensures content fits without scrolling when info icon is present */
.list-card {
    min-height: 280px;
}

.list-card .card-body { 
    padding: 0.5rem 1.25rem;
    overflow-y: auto;
    position: relative;
    /* Increased from 3rem to 4rem to prevent info icon overlap with progress bar */
    /* Mobile maintains this 4rem value (previously had same issue) */
    padding-bottom: 4rem;
}

.detail-list { 
    list-style: none;
}

.detail-item { 
    display: flex; 
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0; 
    border-bottom: 1px solid var(--border-color); 
    font-size: 0.875rem;
    gap: 1rem;
}

.detail-item:last-child { 
    border-bottom: none; 
}

.detail-label { 
    font-weight: 500;
    color: var(--text-color);
    flex: 0 0 auto;
    max-width: 60%;
    word-wrap: break-word;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.playground-item-icon {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

.detail-value { 
    color: var(--text-light);
    font-weight: 500;
    text-align: right;
    margin-left: auto;
    padding-left: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.yes-badge, .no-badge { 
    padding: 0.2rem 0.6rem; 
    border-radius: 100px; 
    font-size: 0.75rem; 
    font-weight: 600;
    color: white;
}

.yes-badge { 
    background: var(--accent-green);
}

.no-badge { 
    background: var(--accent-red);
}

/* --- Responsive & Mobile --- */
.sidebar-toggle-btn { 
    display: none; 
    background: transparent;
    border: none; 
    font-size: 1.25rem; 
    cursor: pointer; 
    color: var(--text-light);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transition: all var(--transition-base);
}

.sidebar-toggle-btn:hover {
    color: var(--primary-red);
}

.sidebar-overlay { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 199; 
    opacity: 0; 
    transition: opacity var(--transition-slow);
}

.sidebar-overlay.visible { 
    display: block; 
    opacity: 1; 
}

/* Desktop-specific improvements for list-card layout (1024px+ for true desktop) */
@media (min-width: 1024px) {
    /* Allow grid rows to expand to fit card content to prevent overlap */
    .card-grid {
        grid-auto-rows: auto;
    }
    
    /* Reduce min-height to minimize whitespace while preventing scrolling */
    .list-card {
        min-height: 320px;
    }
    
    /* Reduce padding to decrease spacing between content and info icon */
    .list-card .card-body {
        padding: 0.75rem 1.5rem;
        padding-bottom: 2.5rem;
        /* Keep overflow-y: auto (default) to prevent card overlap */
    }
    
    /* Position info icon closer to bottom for tighter spacing */
    .list-card .info-icon-btn {
        bottom: 0.75rem;
    }
}

@media (min-width: 993px) {
    .header-logo-desktop {
        display: none;
    }
    
    .header-logo-mobile {
        display: none;
    }
}

@media (max-width: 992px) {
    .sidebar { 
        transform: translateX(-100%); 
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.open { 
        transform: translateX(0);
    }
    
    .main-content { 
        margin-left: 0; 
    }
    
    .sidebar-toggle-btn { 
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .header-logo-desktop {
        display: none;
    }
    
    .header-logo-mobile {
        display: block;
    }
}

@media (max-width: 576px) { 
    .card-grid { 
        grid-template-columns: 1fr; 
        grid-auto-rows: auto;
    }
    
    .data-card { 
        min-height: 200px;
    }
    
    .data-card.tile-double-width { 
        grid-column: span 1; 
    }
    
    .data-card.tile-double-height { 
        grid-row: span 1; 
    }
    
    .data-card.tile-double-both { 
        grid-column: span 1; 
        grid-row: span 1; 
    }
    
    .main-header { 
        padding: 1rem; 
    }
    
    .header-titles h1 {
        font-size: 1.25rem;
    }
    
    .header-logo-main {
        height: 32px;
    }
    
    .header-logo {
        height: 32px;
    }
    
    /* Fix sticky banner position for mobile portrait */
    .sticky-category-banner {
        top: 73px; /* Match actual mobile header height to prevent overlap */
        height: calc((1rem + 1rem + 32px) / 3); /* 1/3 of main header height */
    }
    
    .content-body { 
        padding: 1rem; 
    }
    
    .stat-value { 
        font-size: 2.5rem; 
    }
    
    /* Ensure list-card has adequate minimum height on mobile to prevent content/icon overlap */
    /* Increased from 280px to 300px to provide more space */
    .list-card {
        min-height: 300px;
    }
    
    /* Add extra bottom padding for cards with info icons on mobile */
    /* Increased from 3.5rem to 4rem for better spacing */
    .list-card .card-body {
        padding-bottom: 4rem;
    }
    
    /* Also ensure stat-card has adequate bottom padding on mobile */
    .stat-card .card-body {
        padding-bottom: 4rem;
    }
    
    /* Ensure utilization-card has adequate bottom padding on mobile
       2.5rem provides more spacing than desktop (2rem) for touch interfaces */
    .utilization-card .card-body {
        padding-bottom: 2.5rem;
    }
    
    /* Remove scrolling from stats-combined-card on mobile as content fits without it */
    .stats-combined-card .card-body {
        overflow: visible;
    }
}

/* Mobile landscape orientation - additional spacing adjustments */
@media (max-width: 992px) and (max-height: 600px) and (orientation: landscape) {
    /* Increase spacing between progress bar and info icon in landscape */
    /* Increased from 3.5rem to 4rem for consistency with portrait */
    .list-card .card-body {
        padding-bottom: 4rem;
    }
    
    /* Ensure adequate minimum height in landscape */
    /* Increased from 240px to 260px for better spacing */
    .list-card {
        min-height: 260px;
    }
    
    /* Add margin to progress bar container for better separation from info icon */
    .detail-item .progress-bar-container {
        margin-bottom: 0.5rem;
    }
    
    /* Ensure stat-card has adequate bottom padding in landscape */
    .stat-card .card-body {
        padding-bottom: 4rem;
    }
    
    /* Ensure utilization-card has adequate bottom padding in landscape */
    .utilization-card .card-body {
        padding-bottom: 2.5rem;
    }
    
    /* Remove scrolling from stats-combined-card on mobile landscape as content fits without it */
    .stats-combined-card .card-body {
        overflow: visible;
    }
}

/* --- Custom Popup Dialog --- */
.custom-popup {
    position: fixed;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    padding: 1.5rem;
    z-index: 1000;
    display: none;
    min-width: 250px;
}

.custom-popup.show {
    display: block;
    animation: popupFadeIn 0.2s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-message {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

.popup-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.popup-button {
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 50px;
    min-height: 50px;
}

.popup-button i {
    opacity: 1;
    font-size: 1.5rem;
}

.popup-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.popup-button-confirm {
    background: var(--accent-green);
    color: white;
    font-size: 1.5rem;
}

.popup-button-confirm:hover {
    background: var(--primary-green);
    transform: translateY(-2px);
}

.popup-button-cancel {
    background: var(--accent-red);
    color: white;
}

.popup-button-cancel:hover {
    background: var(--over-capacity-red);
    transform: translateY(-2px);
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
}

.popup-overlay.show {
    display: block;
}

/* --- Info Dialog --- */
/* --- Info Icon Button --- */
.info-icon-btn {
    position: absolute;
    bottom: 1.25rem;
    right: 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-base);
    opacity: 0.5;
}

.info-icon-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.info-icon-btn:focus {
    outline: none;
    opacity: 1;
}

.info-icon-btn img {
    width: 100%;
    height: 100%;
    filter: invert(72%) sepia(0%) saturate(0%) hue-rotate(189deg) brightness(92%) contrast(88%);
}

.info-icon-btn:hover img {
    filter: invert(47%) sepia(19%) saturate(1618%) hue-rotate(318deg) brightness(89%) contrast(83%);
}

/* --- Translation Widget Custom Styling --- */
.jigts-widget-trigger {
    position: fixed !important;
    opacity: 0.85 !important;
    transition: all var(--transition-base) !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    bottom: 0.75rem !important;
    right: 0.75rem !important;
    padding: 0 !important;
    z-index: 300 !important;
}

.jigts-widget-trigger:hover {
    opacity: 1 !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
    border-color: var(--primary-red) !important;
}

/* Ensure the icon inside is properly sized and colored */
.jigts-widget-trigger svg,
.jigts-widget-trigger i {
    color: var(--primary-red) !important;
    width: 20px !important;
    height: 20px !important;
}

/* Make the language code text smaller and more compact */
.jigts-widget-trigger span,
.jigts-widget-trigger .jigts-language-code {
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    pointer-events: none !important;
}

/* Position the language selection menu centered in viewport - 75% of original width */
.jigts-widget-menu {
    position: fixed !important;
    bottom: auto !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 75% !important;
    max-width: 600px !important;
    max-height: min(400px, calc(100vh - 120px)) !important;
    overflow-y: auto !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow-xl) !important;
    border: 1px solid var(--border-color) !important;
    padding: 0.5rem !important;
    z-index: 1000 !important;
}

/* Make menu items more compact */
.jigts-widget-menu .jigts-language-item {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    border-radius: 6px !important;
    margin: 0.125rem 0 !important;
}

.jigts-widget-menu .jigts-language-item:hover {
    background: var(--bg-color) !important;
}

/* Remove hover effect from language code display */
.jigts-widget-trigger span:hover,
.jigts-widget-trigger .jigts-language-code:hover {
    background: transparent !important;
    color: inherit !important;
    text-decoration: none !important;
}

/* Hide the full language name tooltip on hover */
.jigts-widget-trigger[title]:hover::after {
    content: none !important;
    display: none !important;
}


/* Status Icon Styles */
.status-icon {
    width: 0.875rem;
    height: 0.875rem;
    margin-right: 0.5rem;
    vertical-align: middle;
    display: inline-block;
}

.status-icon-requested {
    filter: brightness(0) saturate(100%) invert(28%) sepia(64%) saturate(2072%) hue-rotate(346deg) brightness(91%) contrast(88%);
}

.status-icon-inprogress {
    filter: brightness(0) saturate(100%) invert(28%) sepia(64%) saturate(2072%) hue-rotate(346deg) brightness(91%) contrast(88%);
}

.status-icon-completed {
    filter: brightness(0) saturate(100%) invert(57%) sepia(33%) saturate(661%) hue-rotate(110deg) brightness(93%) contrast(85%);
}

/* --- Catchment Map Card Styles --- */
.catchment-map-card {
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.catchment-map-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.catchment-map-card .card-body {
    padding: 0;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.catchment-map-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.catchment-map-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-slow);
}

.catchment-map-card:hover .catchment-map-image {
    transform: scale(1.05);
}

.catchment-map-content {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem 1.25rem;
    color: white;
}

.catchment-map-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.catchment-info-item {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    font-size: 0.875rem;
}

.catchment-label {
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.catchment-value {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.catchment-info-note {
    font-size: 0.75rem;
    font-style: italic;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.4;
}

.detail-note {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
    padding-left: 0 !important;
}

/* --- Map Lightbox Styles --- */
.map-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    animation: fadeIn 0.3s ease-in-out;
}

.map-lightbox.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.map-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.map-lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    z-index: 10001;
    backdrop-filter: blur(10px);
}

.map-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-btn-icon {
    width: 1.5rem;
    height: 1.5rem;
    opacity: 0.8;
}

.map-lightbox-controls {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10001;
}

.map-control-btn {
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
}

.map-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.map-control-btn:active {
    transform: scale(0.95);
}

.map-lightbox-content {
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.map-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: grab;
    transition: transform 0.2s ease-out;
    user-select: none;
    -webkit-user-drag: none;
}

.map-lightbox-image.dragging {
    cursor: grabbing;
    transition: none;
}

.map-lightbox-image.zoomed {
    cursor: move;
}

/* Mobile adjustments for lightbox */
@media (max-width: 768px) {
    .map-lightbox-close,
    .map-control-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
    
    .map-lightbox-close {
        top: 1rem;
        right: 1rem;
    }
    
    .map-lightbox-controls {
        top: 1rem;
        left: 1rem;
        gap: 0.5rem;
    }
    
    .map-lightbox-content {
        width: 95%;
        height: 95%;
    }
}
