:root {
    /* Dark Mode (Default) */
    --bg-main: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-header: rgba(15, 23, 42, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #fbbf24;
    --accent-glow: rgba(251, 191, 36, 0.3);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
    --bg-main: #ffffff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-header: rgba(248, 250, 252, 0.8);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #1e3a8a;
    /* Navy Blue */
    --accent-glow: rgba(30, 58, 138, 0.15);
    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Kanit', sans-serif;
    line-height: 1.6;
}

/* Glassmorphism Header */
header {
    background-color: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    border-bottom: 1px solid var(--border);
}

body {
    padding-top: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--accent);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.filter-bar {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 35px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.filter-header {
    margin-bottom: 30px;
}

.filter-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-form {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 25px;
    align-items: flex-end;
}

.search-input-group, .year-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-form label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 1rem;
}

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

.input-wrapper i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.filter-form input, .filter-form select {
    width: 100%;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
    height: 56px;
}

.filter-form input {
    padding-left: 50px;
}

.filter-form select {
    cursor: pointer;
}

.filter-form input:focus, .filter-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.filter-form .btn-primary {
    height: 56px;
    padding: 0 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--accent);
    color: #fff;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.theme-toggle {
    cursor: pointer;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--accent);
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.theme-toggle:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.05);
}

/* Announcement Slider */
.announcement-container {
    padding: 20px 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.slider-wrapper {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    height: 450px;
    /* Increased height */
    box-shadow: var(--shadow);
}

.announcement-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.announcement-grid.no-list {
    grid-template-columns: 1fr;
    max-width: 1000px;
    /* Centered and not too wide */
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 1024px) {
    .announcement-grid {
        grid-template-columns: 1fr;
    }

    .slider-wrapper {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .slider-wrapper {
        height: 250px;
    }
}

.slider {
    display: flex;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide {
    min-width: 100%;
    position: relative;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
}

.slide-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

/* Slider Controls */
.slider-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    /* Darker background */
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.slider-control:hover {
    background: var(--accent);
    color: #000;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 20px var(--accent-glow);
}

.slider-control.prev {
    left: 20px;
}

.slider-control.next {
    right: 20px;
}

.slider-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s;
}

.indicator.active {
    background: var(--accent);
    width: 30px;
    border-radius: 10px;
}

/* Text Announcements */
.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 450px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Custom Scrollbar for Announcement List */
.announcement-list::-webkit-scrollbar {
    width: 6px;
}

.announcement-list::-webkit-scrollbar-track {
    background: transparent;
}

.announcement-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.announcement-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.announcement-item {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    gap: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.announcement-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.announcement-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--accent-glow);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.announcement-info h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.announcement-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Gallery Section */
.gallery-container {
    padding: 40px 5%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.gallery-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.gallery-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.card-image-wrapper {
    position: relative;
    padding-top: 66.67%;
    /* 3:2 Aspect Ratio */
    overflow: hidden;
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.gallery-card:hover .card-image {
    transform: scale(1.1);
}

.card-content {
    padding: 20px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.card-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Hero Section */
.hero {
    min-height: 400px;
    /* Base height */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 40px;
    padding: 60px 5%;
    overflow: hidden;
}

@media (max-width: 1024px) {
    .hero {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .hero {
        min-height: 250px;
        padding: 40px 5%;
    }
}

.hero::before {
    display: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Buttons */
.btn-primary {
    background: var(--accent);
    color: #fff;
    padding: 12px 30px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 60px 5% 30px;
    border-top: 1px solid var(--border);
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    margin-bottom: 20px;
    color: var(--accent);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    /* Hide completely */
    width: 300px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 3000;
    padding: 80px 40px;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow);
    border-left: 1px solid var(--border);
    visibility: hidden;
    /* Hide from screen readers too */
}

.mobile-menu.active {
    right: 0;
    visibility: visible;
}

.mobile-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.mobile-menu .close-menu {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2500;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Pagination */
.btn-pagination:hover {
    background: var(--accent) !important;
    color: #000 !important;
    border-color: var(--accent) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-pagination i {
    transition: transform 0.3s;
}

.btn-pagination:hover i {
    transform: scale(1.2);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2rem;
    }

    /* Mobile Header Adjustments */
    .header-actions {
        gap: 12px;
    }

    .theme-toggle {
        padding: 8px;
        border-radius: 50%;
        width: 38px;
        height: 38px;
        justify-content: center;
    }

    .theme-text {
        display: none !important;
    }

    .filter-bar {
        padding: 25px 20px;
        border-radius: 20px;
        margin-bottom: 25px;
    }

    .filter-form {
        grid-template-columns: 1fr !important;
        gap: 22px !important;
        align-items: stretch !important;
    }
    
    .filter-header h2 {
        font-size: 1.4rem !important;
        line-height: 1.4;
        gap: 10px !important;
    }

    .filter-form label {
        font-size: 0.95rem !important;
        margin-bottom: 5px !important;
    }

    .filter-form input, .filter-form select {
        width: 100% !important;
        min-width: 0 !important;
        height: 56px !important; 
        font-size: 1rem !important;
        padding: 0 20px !important;
    }

    .filter-form input {
        padding-left: 55px !important;
    }

    .filter-form .btn-primary {
        width: 100% !important;
        justify-content: center;
        height: 58px !important;
        margin-top: 10px;
        font-size: 1.15rem !important;
        box-shadow: 0 4px 15px var(--accent-glow);
    }

    .search-input-group, .year-input-group {
        width: 100% !important;
    }
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 20px var(--accent-glow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.back-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 25px var(--accent-glow);
    background: #fff;
    color: var(--accent);
}