/* ============================================================
   Modern Institutional Design System — โรงเรียนบ้านวังนกแอ่น
   ============================================================ */

:root {
    --brand-navy: #0f2557;
    --brand-primary: #1d4ed8;
    --brand-primary-light: #3b82f6;
    --brand-primary-soft: #eff6ff;
    --brand-accent: #f59e0b;
    --brand-accent-hover: #d97706;
    --brand-accent-soft: #fffbeb;
    --surface-bg: #f1f5f9;
    --surface-card: #ffffff;
    --text-main: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --border-subtle: #e2e8f0;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 18px 38px -10px rgba(15, 37, 87, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--surface-bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(29, 78, 216, 0.07) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.06) 0px, transparent 45%);
    background-attachment: fixed;
    color: var(--text-body);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6,
.font-heading,
.navbar-brand,
.nav-link,
.btn,
.section-title,
.widget-title {
    font-family: 'Prompt', 'Sarabun', sans-serif;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color 0.18s ease;
}

a:hover {
    color: var(--brand-navy);
}

img {
    max-width: 100%;
    height: auto;
}

/* ---------- Top Utility Bar ---------- */
.top-utility-bar {
    background: var(--brand-navy);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.85rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-utility-bar a {
    color: rgba(255, 255, 255, 0.9);
}

.top-utility-bar a:hover {
    color: var(--brand-accent);
}

/* ---------- School Hero Header ---------- */
.school-header {
    background: linear-gradient(135deg, #0f2557 0%, #1e3a8a 52%, #1d4ed8 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.school-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 85% 20%, rgba(245, 158, 11, 0.22), transparent 42%),
        radial-gradient(circle at 12% 85%, rgba(96, 165, 250, 0.2), transparent 45%);
    pointer-events: none;
}

.school-header-inner {
    position: relative;
    z-index: 1;
    padding: 1.6rem 0;
}

.school-emblem {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.14);
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fcd34d;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.school-title {
    font-size: clamp(1.35rem, 2.4vw, 1.95rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    color: #ffffff;
}

.school-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.84);
    margin: 0.15rem 0 0;
}

.header-quick-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.header-quick-pill:hover {
    background: #ffffff;
    color: var(--brand-navy);
    transform: translateY(-1px);
}

.header-quick-pill.pill-accent {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
    color: #0f172a;
}

.header-quick-pill.pill-accent:hover {
    background: #fbbf24;
    color: #0f172a;
}

/* ---------- Modern Sticky Navbar ---------- */
.modern-navbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    padding: 0.55rem 0;
    z-index: 1020;
}

.modern-navbar .nav-link {
    font-weight: 500;
    font-size: 0.93rem;
    color: var(--text-main);
    padding: 0.55rem 0.95rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.modern-navbar .nav-link:hover,
.modern-navbar .nav-link.active,
.modern-navbar .show > .nav-link {
    color: var(--brand-primary);
    background: var(--brand-primary-soft);
}

.modern-navbar .dropdown-menu {
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    min-width: 230px;
    margin-top: 0.4rem;
}

.modern-navbar .dropdown-item {
    border-radius: 9px;
    padding: 0.55rem 0.85rem;
    font-size: 0.92rem;
    color: var(--text-body);
    transition: all 0.15s ease;
}

.modern-navbar .dropdown-item:hover {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
    transform: translateX(3px);
}

/* ---------- Hero Slider ---------- */
.hero-slider-wrapper {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: #0f172a;
    position: relative;
}

.hero-slider-wrapper .carousel-item {
    aspect-ratio: 21 / 9;
    max-height: 440px;
    min-height: 220px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

.hero-slider-wrapper .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.15) 45%, transparent 100%);
    pointer-events: none;
}

.hero-slider-wrapper .carousel-caption {
    text-align: left;
    left: 2rem;
    right: 2rem;
    bottom: 1.5rem;
    padding: 0;
}

.hero-slider-wrapper .carousel-indicators [data-bs-target] {
    width: 28px;
    height: 4px;
    border-radius: 999px;
    border: 0;
    background-color: rgba(255, 255, 255, 0.5);
    transition: all 0.25s ease;
}

.hero-slider-wrapper .carousel-indicators .active {
    width: 42px;
    background-color: var(--brand-accent);
}

.hero-slider-wrapper .carousel-control-prev,
.hero-slider-wrapper .carousel-control-next {
    width: 48px;
    height: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    border-radius: 50%;
    margin: 0 1rem;
    opacity: 0.85;
}

.hero-slider-wrapper .carousel-control-prev:hover,
.hero-slider-wrapper .carousel-control-next:hover {
    background: rgba(29, 78, 216, 0.9);
    opacity: 1;
}

/* ---------- Announcement Ticker ---------- */
.ticker-bar {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
}

.ticker-badge {
    background: linear-gradient(135deg, var(--brand-accent), var(--brand-accent-hover));
    color: #0f172a;
    font-family: 'Prompt', sans-serif;
    font-weight: 600;
    font-size: 0.84rem;
    padding: 0.65rem 1.1rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.ticker-track {
    overflow: hidden;
    flex: 1;
    padding: 0 1rem;
    white-space: nowrap;
}

.ticker-content {
    display: inline-block;
    padding-left: 100%;
    animation: ticker-scroll 26s linear infinite;
    font-size: 0.94rem;
    color: var(--text-main);
}

.ticker-bar:hover .ticker-content {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ---------- Modern Cards & Widgets ---------- */
.modern-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.modern-card-header {
    padding: 1rem 1.25rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.modern-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.title-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.title-icon.icon-amber {
    background: var(--brand-accent-soft);
    color: var(--brand-accent-hover);
}

.title-icon.icon-emerald {
    background: #ecfdf5;
    color: #059669;
}

.title-icon.icon-violet {
    background: #f5f3ff;
    color: #7c3aed;
}

.modern-card-body {
    padding: 1.25rem;
}

/* ---------- Sidebar Navigation List ---------- */
.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    color: var(--text-body);
    font-size: 0.94rem;
    font-weight: 500;
    transition: all 0.18s ease;
    gap: 0.5rem;
}

.sidebar-nav-item:hover {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
    transform: translateX(3px);
}

.sidebar-nav-item i.chevron {
    font-size: 0.78rem;
    color: var(--text-muted);
    transition: transform 0.18s ease;
}

.sidebar-nav-item:hover i.chevron {
    color: var(--brand-primary);
    transform: translateX(3px);
}

/* ---------- Director / Boss Card ---------- */
.director-portrait-wrap {
    width: 100%;
    max-width: 210px;
    aspect-ratio: 4 / 5;
    margin: 0 auto 0.9rem;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, #e0e7ff, #f1f5f9);
    border: 3px solid #ffffff;
    box-shadow: 0 8px 20px rgba(15, 37, 87, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.director-portrait-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.director-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    padding: 1rem;
    text-align: center;
}

.director-fallback i {
    font-size: 3.4rem;
    opacity: 0.75;
}

.cms-boss-content p {
    margin-bottom: 0.4rem;
}

.cms-boss-content img {
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    max-height: 240px;
    object-fit: cover;
}

/* ---------- News Cards ---------- */
.news-featured-card {
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.news-featured-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.news-featured-thumb {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(135deg, #e2e8f0, #f8fafc);
    position: relative;
}

.news-featured-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.news-featured-card:hover .news-featured-thumb img {
    transform: scale(1.05);
}

.news-list-item {
    display: flex;
    gap: 0.9rem;
    padding: 0.75rem;
    border-radius: 13px;
    border: 1px solid var(--border-subtle);
    background: #ffffff;
    transition: all 0.2s ease;
    align-items: center;
}

.news-list-item:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.news-list-thumb {
    width: 108px;
    height: 78px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #e2e8f0, #f8fafc);
}

.news-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.news-list-item:hover .news-list-thumb img {
    transform: scale(1.06);
}

.news-title-clamp {
    font-family: 'Prompt', sans-serif;
    font-weight: 500;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
}

.news-excerpt-clamp {
    font-size: 0.88rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.author-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #ecfdf5;
    color: #047857;
}

/* ---------- Modern Pill Tabs (tab_2) ---------- */
.modern-tabs {
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 1rem 0;
    gap: 0.4rem;
    background: #f8fafc;
}

.modern-tabs .nav-link {
    border: none;
    border-radius: 10px 10px 0 0;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.65rem 1.05rem;
    position: relative;
    transition: all 0.18s ease;
}

.modern-tabs .nav-link:hover {
    color: var(--brand-primary);
    background: rgba(29, 78, 216, 0.05);
}

.modern-tabs .nav-link.active {
    color: var(--brand-primary);
    background: #ffffff;
    box-shadow: 0 -2px 0 var(--brand-primary) inset;
}

.doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px dashed var(--border-subtle);
    border-radius: 10px;
    transition: background 0.15s ease;
}

.doc-row:last-child {
    border-bottom: none;
}

.doc-row:hover {
    background: #f8fafc;
}

.date-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- Gallery Grid ---------- */
.gallery-card {
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.gallery-thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    background: #e2e8f0;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-card:hover .gallery-thumb img {
    transform: scale(1.07);
}

.gallery-overlay-icon {
    position: absolute;
    inset: 0;
    background: rgba(15, 37, 87, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    color: #ffffff;
    font-size: 1.65rem;
}

.gallery-card:hover .gallery-overlay-icon {
    opacity: 1;
}

/* ---------- Visitor Counter Widget ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
}

.stat-tile {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: 11px;
    padding: 0.6rem 0.7rem;
    text-align: center;
}

.stat-tile.stat-highlight {
    grid-column: span 2;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    border-color: #bfdbfe;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.stat-value {
    font-family: 'Prompt', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
}

.online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    animation: pulse-green 1.8s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ---------- Partner Banners ---------- */
.partner-banner-link {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #ffffff;
}

.partner-banner-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ---------- Article Content Styling ---------- */
.article-content {
    font-size: 1.02rem;
    line-height: 1.8;
    color: var(--text-body);
}

.article-content img {
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin: 0.75rem 0;
}

.article-meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    padding: 0.8rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.2rem;
    color: #cbd5e1;
    display: block;
    margin-bottom: 0.5rem;
}

/* ---------- Modern Footer ---------- */
.modern-footer {
    margin-top: auto;
    background: linear-gradient(180deg, #0f2557 0%, #09183a 100%);
    color: rgba(255, 255, 255, 0.82);
    padding: 2.75rem 0 1.5rem;
    border-top: 3px solid var(--brand-accent);
}

.modern-footer h6 {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 0.9rem;
}

.modern-footer a {
    color: rgba(255, 255, 255, 0.78);
}

.modern-footer a:hover {
    color: #fcd34d;
}

.footer-divider {
    border-color: rgba(255, 255, 255, 0.12);
    margin: 1.5rem 0 1rem;
}

/* ---------- DataTables Bootstrap 5 Tweaks ---------- */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select,
div.dt-container .dt-search input,
div.dt-container .dt-length select {
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    padding: 0.35rem 0.65rem;
}

.table-modern thead th {
    background: #f8fafc;
    color: var(--text-main);
    font-family: 'Prompt', sans-serif;
    font-weight: 500;
    font-size: 0.88rem;
    border-bottom: 2px solid var(--border-subtle);
    white-space: nowrap;
}

.table-modern tbody td {
    vertical-align: middle;
    font-size: 0.93rem;
}

/* ---------- Print ---------- */
@media print {
    .top-utility-bar,
    .modern-navbar,
    .hero-slider-wrapper,
    .ticker-bar,
    .sidebar-col,
    .modern-footer,
    .no-print {
        display: none !important;
    }
    .main-col {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    body {
        background: #ffffff !important;
    }
    .modern-card {
        box-shadow: none !important;
        border: none !important;
    }
}
