/* ================================================
   High Courts of Sri Lanka – Main Stylesheet
   Theme: Maroon-Orange & Gold
   Single-Screen Compact Hero Portal (Matching District Court Layout)
   ================================================ */

:root {
    /* Theme: Core High Court Colors */
    --primary-color: #993300;       /* Maroon mix orange - Serious & Warm */
    --secondary-color: #b34700;     /* Slightly lighter maroon-orange for hover states */
    --gold-accent: #c5a059;         /* Official Judiciary Gold */
    --gold-light: #e4c580;          /* Light gold shimmer */
    --gold-dark: #a68a42;           /* Deep gold tone */
    
    --text-light: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.75);
    --text-dark: #222222;
    --bg-dark: #1a0800;
    --primary-deep: #4a1800;        /* Deep rich maroon-orange */
    --primary-darker: #2f1000;      /* Darkest maroon for bars & overlays */
    --primary-light: #cc4e00;

    /* Shadows */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.45);
    --shadow-heavy: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-gold: 0 4px 20px rgba(197, 160, 89, 0.3);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================
   Reset & Base
   ================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-light);
    background: url('../images/h2.webp') center center / cover no-repeat fixed;
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, rgba(74, 24, 0, 0.72) 0%, rgba(153, 51, 0, 0.25) 50%, rgba(31, 11, 0, 0.85) 100%);
    z-index: -1;
    pointer-events: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(26, 8, 0, 0.85);
}

::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-accent);
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}

.grid-container {
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 clamp(16px, 2.5vw, 36px);
}

a {
    text-decoration: none;
    color: inherit;
}

/* ================================================
   Main Centered Wrapper
   ================================================ */
.page-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(20px, 3.5vh, 48px) 0;
    position: relative;
    z-index: 2;
    min-height: 0;
}

/* ================================================
   Hero Section
   ================================================ */
.hero {
    position: relative;
    padding-top: 0;
    padding-bottom: clamp(10px, 1.5vh, 16px);
    background: none;
    overflow: visible;
    z-index: 2;
}

.hero-overlay {
    display: none;
}

.hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hero-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--gold-accent);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 8s infinite ease-in-out;
}

@keyframes particleFloat {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
    20% { opacity: 0.6; }
    50% { opacity: 0.3; transform: translateY(-120px) scale(1); }
    80% { opacity: 0.6; }
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 100%;
    text-align: left;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
}

.hero-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(2.4rem, 4.2vw, 3.8rem);
    font-weight: 700;
    color: var(--text-light);
    line-height: 1.15;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
}

.gold-text {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-accent), var(--gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.hero-description {
    font-size: clamp(0.82rem, 1.05vw, 0.95rem);
    color: rgba(255, 255, 255, 0.9);
    max-width: 820px;
    margin: 0 0 12px;
    line-height: 1.45;
    font-weight: 400;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

/* Hero Stats */
.hero-stats {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(16px, 2.5vw, 32px);
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: left;
}

.stat-number {
    font-family: 'Montserrat', sans-serif !important;
    font-size: clamp(1.2rem, 1.8vw, 1.45rem);
    font-weight: 700;
    color: var(--gold-accent);
    line-height: 1;
    margin-bottom: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.stat-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 500;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: rgba(197, 160, 89, 0.3);
}

/* ================================================
   Search & Filter Bar
   ================================================ */
.search-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 16px;
    padding: 6px 12px;
    background: rgba(45, 16, 5, 0.82);
    border-radius: 12px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(197, 160, 89, 0.35);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    max-width: 920px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-filter-bar:focus-within {
    border-color: var(--gold-accent);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(197, 160, 89, 0.25);
}

.search-box {
    position: relative;
    flex: 1 1 200px;
    min-width: 170px;
}

.search-box i.fa-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-accent);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 8px 32px 8px 34px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 0.84rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.35);
    transition: all var(--transition-fast);
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.search-box input:focus {
    outline: none;
    border-color: var(--gold-accent);
    background: rgba(0, 0, 0, 0.55);
    box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.25);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color var(--transition-fast);
}

.search-clear.visible {
    display: block;
}

.search-clear:hover {
    color: var(--gold-accent);
}

/* District Dropdown Filter */
.district-filter-box {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 175px;
}

.district-icon {
    position: absolute;
    left: 10px;
    color: var(--gold-accent);
    font-size: 0.78rem;
    pointer-events: none;
    z-index: 1;
}

.district-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 7px 28px 7px 28px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.district-select:hover {
    border-color: var(--gold-accent);
    background: rgba(197, 160, 89, 0.12);
    color: #ffffff;
}

.district-select:focus {
    border-color: var(--gold-accent);
    background: rgba(0, 0, 0, 0.55);
    box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.25);
    color: #ffffff;
}

.district-select option {
    background-color: #2f1000;
    color: #ffffff;
    padding: 8px 12px;
}

.select-arrow {
    position: absolute;
    right: 10px;
    color: var(--gold-accent);
    font-size: 0.65rem;
    pointer-events: none;
    transition: transform var(--transition-fast);
}

.district-filter-box:focus-within .select-arrow {
    transform: rotate(180deg);
}

.filter-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--gold-accent);
    color: var(--gold-accent);
    background: rgba(197, 160, 89, 0.15);
}

.filter-btn.active {
    background: var(--gold-accent);
    color: var(--primary-deep);
    border-color: var(--gold-accent);
    font-weight: 600;
}

.filter-count {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
}

.filter-btn.active .filter-count {
    background: rgba(0, 0, 0, 0.22);
    color: var(--primary-deep);
    font-weight: 700;
}

.filter-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.active-dot {
    background: #22c55e;
}

.coming-dot {
    background: var(--gold-accent);
}

.filter-btn.active .coming-dot {
    background: var(--primary-deep);
}

.filter-btn.active .active-dot {
    background: #15803d;
}

/* ================================================
   Courts Section
   ================================================ */
.courts-section {
    background: none;
    padding-top: clamp(6px, 1.2vh, 14px);
    padding-bottom: clamp(10px, 1.8vh, 22px);
    position: relative;
    z-index: 2;
}

/* Courts Grid - 11 columns on desktop for 33 courts (3 rows of 11) */
.courts-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 7px;
    margin-bottom: 0;
    position: relative;
}

/* Court Card */
.court-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    min-height: 42px;
    background: rgba(45, 16, 5, 0.72);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    text-align: center;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
    overflow: hidden;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    text-decoration: none;
}

.court-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold-light), var(--gold-accent));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.court-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    border-color: var(--gold-accent);
    background: rgba(65, 22, 6, 0.94);
}

.court-card:hover::before {
    opacity: 1;
}

/* Featured (Active) Card - Colombo */
.court-card.featured {
    border: 1.5px solid var(--gold-accent);
    background: rgba(65, 22, 6, 0.88);
    box-shadow: 0 4px 18px rgba(197, 160, 89, 0.3);
}

.court-card.featured::before {
    opacity: 1;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-accent), var(--gold-light), var(--gold-accent));
}

.court-card.featured:hover {
    box-shadow: 0 8px 28px rgba(197, 160, 89, 0.45);
    border-color: #ffd885;
}

/* Card Shine Effect */
.card-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 60%
    );
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.court-card:hover .card-shine {
    transform: translateX(100%);
}

/* Card Active Badge */
.card-active-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    50% { transform: scale(1.15); opacity: 0.9; box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}

/* Card Title */
.court-card .card-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.66rem, 0.72vw, 0.76rem);
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0;
    line-height: 1.15;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    transition: color var(--transition-fast);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    padding: 0 2px;
}

.court-card.featured .card-title {
    color: var(--gold-light);
    font-weight: 700;
}

.court-card:hover .card-title {
    color: var(--gold-light);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.no-results i {
    font-size: 2.2rem;
    margin-bottom: 12px;
    color: var(--gold-accent);
    opacity: 0.85;
}

.no-results h3 {
    font-size: 1.15rem;
    color: #ffffff;
    margin-bottom: 6px;
}

.no-results p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

/* Card hidden by filter */
.court-card.hidden {
    display: none !important;
}

/* ================================================
   Bottom Bar
   ================================================ */
.bottom-bar {
    background: rgba(26, 8, 0, 0.92);
    padding: 10px 0;
    text-align: center;
    border-top: 1px solid rgba(197, 160, 89, 0.2);
    margin-top: auto;
    position: relative;
    z-index: 10;
}

.bottom-bar p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.3px;
}

/* ================================================
   Back to Top
   ================================================ */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--gold-accent);
    border: 1px solid rgba(197, 160, 89, 0.3);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: all var(--transition-smooth);
    z-index: 900;
    box-shadow: var(--shadow-medium);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--gold-accent);
}

/* ================================================
   Animations
   ================================================ */
[data-animate] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

[data-animate].animated {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* ================================================
   Responsive Breakpoints & Zoom Handling
   ================================================ */

/* Laptops (1080px - 1240px) */
@media (max-width: 1240px) {
    .courts-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 6px;
    }
}

/* Standard Tablets Landscape (890px - 1079px) */
@media (max-width: 1079px) {
    .courts-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }
    
    .court-card {
        min-height: 40px;
    }
}

/* Medium Tablets (720px - 889px) */
@media (max-width: 889px) {
    .courts-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .hero-stats {
        gap: 20px;
    }
}

/* Small Tablets & Mobile Landscape (640px - 889px) */
@media (max-width: 640px) {
    .page-main {
        justify-content: flex-start;
        padding-top: 16px;
        padding-bottom: 24px;
    }

    .hero {
        padding-top: 12px;
    }

    .hero-title,
    .hero-description {
        text-align: center;
    }

    .hero-stats {
        justify-content: center;
        gap: 16px;
    }

    .stat-item {
        text-align: center;
    }

    .search-filter-bar {
        justify-content: center;
        padding: 8px 10px;
    }

    .search-box {
        width: 100%;
        min-width: 100%;
    }

    .district-filter-box {
        width: 100%;
        min-width: 100%;
    }

    .filter-group {
        width: 100%;
        justify-content: center;
    }

    .courts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
}

/* Mobile Portrait (< 460px) */
@media (max-width: 460px) {
    .hero-title {
        font-size: 1.6rem;
    }

    .hero-description {
        font-size: 0.82rem;
    }

    .hero-stats {
        gap: 12px;
    }

    .stat-number {
        font-size: 1.15rem;
    }

    .stat-divider {
        height: 24px;
    }

    .courts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .court-card {
        min-height: 38px;
        padding: 4px 6px;
    }

    .court-card .card-title {
        font-size: 0.72rem;
    }

    .district-select {
        font-size: 0.74rem;
        padding: 6px 24px 6px 26px;
    }

    .filter-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
    }
}