/* ==========================================================================
   RAMKHAMHAENG UNIVERSITY (UDON THANI) — NAVY BLUE & IMPERIAL GOLD DESIGN SYSTEM
   Tone: Academic, Regal, Ultra-Premium, Prestigious
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Royal Navy Blue Shades (น้ำเงินรามคำแหงสง่างาม) */
    --faculty-primary: #001f54;
    --faculty-primary-light: #0d3b75;
    --faculty-primary-dark: #001233;
    --faculty-primary-subtle: #edf3fa;

    /* Imperial Gold Shades (ทองคำจักรวรรดิ์สุดหรูหรา) */
    --faculty-accent: #d4af37;
    --faculty-accent-hover: #b89120;
    --faculty-accent-light: #fef9c3;
    --faculty-accent-gradient: linear-gradient(135deg, #fae084 0%, #d4af37 50%, #b89120 100%);
    --faculty-accent-soft: rgba(212, 175, 55, 0.15);

    /* Backgrounds & Surfaces */
    --faculty-surface: #ffffff;
    --faculty-bg: #f8fafc;
    --faculty-bg-alt: #edf3fa;
    --faculty-border: #dbe4f0;
    --faculty-text-dark: #0a192f;
    --faculty-text-muted: #475569;

    /* Shadows & Radii */
    --faculty-shadow-sm: 0 4px 12px rgba(0, 31, 84, 0.06);
    --faculty-shadow-md: 0 10px 28px rgba(0, 31, 84, 0.10);
    --faculty-shadow-lg: 0 20px 48px rgba(0, 31, 84, 0.18);
    --faculty-radius: 14px;
    --faculty-radius-sm: 8px;
    --faculty-radius-lg: 20px;
    --faculty-font: 'Kanit', 'Plus Jakarta Sans', sans-serif;
}

body {
    font-family: var(--faculty-font);
    background-color: var(--faculty-bg);
    color: var(--faculty-text-dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1 0 auto;
}

/* ==========================================================================
   Typography & Global Utilities
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--faculty-primary);
    letter-spacing: -0.01em;
}

.text-gold {
    color: var(--faculty-accent) !important;
}

.bg-gold {
    background: var(--faculty-accent-gradient) !important;
    color: #001233 !important;
}

.text-faculty-primary {
    color: var(--faculty-primary) !important;
}

.bg-faculty-primary {
    background-color: var(--faculty-primary) !important;
}

.bg-faculty-light {
    background-color: #f8fafc !important;
}

.hover-gold:hover {
    color: var(--faculty-accent) !important;
    transition: color 0.2s ease;
}

/* ==========================================================================
   Navbar & Header (Navy Blue & Imperial Gold)
   ========================================================================== */
.faculty-topbar {
    background-color: var(--faculty-primary-dark);
    color: #dbe4f0;
    font-size: 0.85rem;
    padding: 7px 0;
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.faculty-navbar {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 31, 84, 0.06);
    padding: 12px 0;
    transition: all 0.3s ease;
    border-bottom: 2px solid var(--faculty-border);
}

.faculty-navbar .navbar-brand {
    font-weight: 700;
    color: var(--faculty-primary);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: normal !important;
    text-decoration: none;
    max-width: calc(100% - 56px);
    flex: 1 1 auto;
    min-width: 0;
    margin-right: 0.5rem;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

.brand-logo-img {
    max-height: 48px;
    max-width: 140px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--faculty-primary);
    word-break: break-word;
    overflow-wrap: break-word;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--faculty-primary) 0%, #0d3b75 60%, var(--faculty-accent) 100%);
    color: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 14px rgba(0, 31, 84, 0.25);
    border: 1px solid rgba(212, 175, 55, 0.3);
    flex-shrink: 0;
}

.brand-text-sub {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--faculty-accent-hover);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.2;
    word-break: break-word;
}

/* Responsive Brand on Mobile & Tablets */
@media (max-width: 991.98px) {
    .faculty-navbar {
        padding: 8px 0;
    }

    .faculty-navbar .navbar-brand {
        gap: 10px;
        max-width: calc(100% - 52px);
    }

    .brand-logo-img {
        max-height: 42px;
        max-width: 46px;
    }

    .brand-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        border-radius: 10px;
    }

    .brand-title {
        font-size: 0.95rem;
        line-height: 1.25;
    }

    .brand-text-sub {
        font-size: 0.68rem;
    }
}

@media (max-width: 575.98px) {
    .faculty-navbar {
        padding: 6px 0;
    }

    .faculty-navbar .navbar-brand {
        gap: 8px;
        max-width: calc(100% - 48px);
        padding-top: 0;
        padding-bottom: 0;
    }

    .brand-logo-img {
        max-height: 36px;
        max-width: 38px;
    }

    .brand-icon {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
        border-radius: 8px;
    }

    .brand-title {
        font-size: 0.82rem;
        line-height: 1.22;
    }

    .brand-text-sub {
        font-size: 0.62rem;
        letter-spacing: 0.02em;
    }

    .faculty-navbar .navbar-toggler {
        padding: 4px 6px;
        font-size: 1.15rem;
    }
}

@media (max-width: 380px) {
    .brand-title {
        font-size: 0.75rem;
        line-height: 1.2;
    }

    .brand-text-sub {
        font-size: 0.58rem;
    }
}

.faculty-nav-link {
    font-weight: 500;
    color: var(--faculty-text-dark) !important;
    padding: 8px 16px !important;
    border-radius: var(--faculty-radius-sm);
    transition: all 0.2s ease;
}

.faculty-nav-link:hover, .faculty-nav-link.active {
    color: var(--faculty-primary) !important;
    background-color: var(--faculty-primary-subtle);
}

/* ==========================================================================
   Hero Section (Navy Blue & Imperial Gold Gradient)
   ========================================================================== */
.hero-section {
    position: relative;
    padding-top: 2rem;
    padding-bottom: 2.5rem;
    background: radial-gradient(circle at 85% 15%, rgba(212, 175, 55, 0.25) 0%, transparent 45%),
                radial-gradient(circle at 10% 85%, rgba(13, 59, 117, 0.6) 0%, transparent 55%),
                linear-gradient(135deg, #001233 0%, #001f54 45%, #0a3366 75%, #182848 100%);
    border-bottom: 3px solid var(--faculty-accent);
    overflow: hidden;
    perspective: 1200px;
}

.hero-section > .container {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   Hero 3D Overlay Background (ฉากศิลาจารึกแบบ 3 มิติ)
   ชั้นต่าง ๆ blend กับ gradient น้ำเงินของ .hero-section โดยตรง
   (ห้ามใส่ transform/opacity/z-index บับเบิลขึ้นไปถึง .hero-3d-bg — จะเกิด
   stacking context ตัด blend; tilt ควบคุมผ่าน CSS vars --rx --ry --tx --ty)
   ========================================================================== */
.hero-3d-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.hero-3d-glow,
.hero-3d-main,
.hero-3d-accent,
.hero-3d-scrim {
    position: absolute;
}

/* ชั้นบรรยากาศ: ภาพเบลอเต็มพื้น เคลื่อนช้ากว่า (พารัลแลกซ์ระยะไกล) */
.hero-3d-glow {
    top: -8%;
    right: -8%;
    bottom: -8%;
    left: -8%;
    background: url('../images/hero-steles-glow.webp') center / cover no-repeat;
    mix-blend-mode: luminosity;
    opacity: 0.5;
    transform:
        rotateX(calc(var(--rx, 0deg) * 0.3))
        rotateY(calc(var(--ry, 0deg) * 0.3))
        translate3d(calc(var(--tx, 0px) * 0.3), calc(var(--ty, 0px) * 0.3), 0)
        scale(1.06);
    will-change: transform;
}

/* ชั้นหลัก: ศิลาจารึกโผล่ทางขวา เคลื่อนตามเคอร์เซอร์เต็มสูตร
   (ล้นขอบขวา + mask ไล่จางสองชั้น จะได้ไม่เห็นเส้นตัดขอบภาพ) */
.hero-3d-main {
    top: 50%;
    right: -5vw;
    width: min(58vw, 860px);
    aspect-ratio: 3 / 2;
    background: url('../images/hero-steles-main.webp') center / cover no-repeat;
    mix-blend-mode: luminosity;
    opacity: 0.88;
    -webkit-mask-image: radial-gradient(92% 88% at 50% 45%, #000 48%, transparent 78%),
                        linear-gradient(to right, transparent 0%, #000 14%, #000 78%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: radial-gradient(92% 88% at 50% 45%, #000 48%, transparent 78%),
                linear-gradient(to right, transparent 0%, #000 14%, #000 78%, transparent 100%);
    mask-composite: intersect;
    transform:
        translateY(-50%)
        rotateX(var(--rx, 0deg))
        rotateY(var(--ry, 0deg))
        translate3d(var(--tx, 0px), var(--ty, 0px), 0);
    will-change: transform;
}

@supports not (aspect-ratio: 1 / 1) {
    .hero-3d-main {
        height: min(40vw, 560px);
    }
}

/* แสงทองประกายเสริมด้านหลังศิลา (เข้าธีมทองของคณะ) */
.hero-3d-accent {
    top: -38%;
    right: -14%;
    width: 62%;
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.30) 0%, transparent 62%);
    mix-blend-mode: screen;
    transform: translate3d(calc(var(--tx, 0px) * 0.6), calc(var(--ty, 0px) * 0.6), 0);
    will-change: transform;
}

/* ม่านไล่เฉดรักษาความอ่านง่ายของตัวอักษร/แครูเซล */
.hero-3d-scrim {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(100deg, rgba(0, 18, 51, 0.72) 0%, rgba(0, 18, 51, 0.20) 42%, transparent 66%),
        linear-gradient(to top, rgba(0, 18, 51, 0.80) 0%, rgba(0, 18, 51, 0.22) 38%, transparent 64%);
}

@media (max-width: 767.98px) {
    .hero-3d-main {
        width: 105vw;
        right: -28vw;
        opacity: 0.6;
    }

    .hero-3d-glow {
        opacity: 0.4;
    }
}

/* อุปกรณ์สัมผัส/ไม่มีเมาส์: ให้ฉากลอยแบบสายลมแทน tilt ตามเคอร์เซอร์ */
@media (hover: none) {
    .hero-3d-main {
        animation: hero3d-drift-main 26s ease-in-out infinite alternate;
    }

    .hero-3d-glow {
        animation: hero3d-drift-glow 34s ease-in-out infinite alternate;
    }
}

@keyframes hero3d-drift-main {
    from {
        transform: translateY(-50%) rotateX(1.2deg) rotateY(-1.8deg) translate3d(-10px, -4px, 0);
    }
    to {
        transform: translateY(-50%) rotateX(-1deg) rotateY(1.8deg) translate3d(10px, 6px, 0);
    }
}

@keyframes hero3d-drift-glow {
    from {
        transform: rotateX(0.5deg) rotateY(-0.8deg) translate3d(-12px, -6px, 0) scale(1.06);
    }
    to {
        transform: rotateX(-0.5deg) rotateY(0.8deg) translate3d(12px, 8px, 0) scale(1.08);
    }
}

/* ผู้ใช้ที่ตั้งค่าลดการเคลื่อนไหว: หยุดอนิเมชันทั้งหมด */
@media (prefers-reduced-motion: reduce) {
    .hero-3d-main,
    .hero-3d-glow {
        animation: none;
    }
}

.hero-carousel {
    border-radius: var(--faculty-radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 18, 51, 0.45);
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: linear-gradient(135deg, rgba(0, 18, 51, 0.95) 0%, rgba(0, 31, 84, 0.95) 100%);
}

.hero-carousel-item {
    min-height: 480px;
    display: flex;
    align-items: center;
    padding: 2.5rem 3rem;
}

@media (max-width: 767.98px) {
    .hero-carousel-item {
        padding: 1.5rem 1rem;
        min-height: auto;
    }
}

.hero-slide-poster-wrap {
    width: 100%;
    max-height: 380px;
    border-radius: var(--faculty-radius);
    overflow: hidden;
    border: 2px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    background: #000c1f;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-slide-poster-img {
    width: 100%;
    max-height: 380px;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.hero-carousel-item:hover .hero-slide-poster-img {
    transform: scale(1.03);
}

.hero-slide-poster-placeholder {
    width: 100%;
    height: 300px;
    background: radial-gradient(circle at center, #0a3366 0%, #001233 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-slide-title {
    color: #ffffff;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-slide-title a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.hero-slide-title a:hover {
    color: var(--faculty-accent-light);
}

.hero-slide-excerpt {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Dedicated Hero Banner Carousel */
.hero-banner-carousel {
    border-radius: var(--faculty-radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 18, 51, 0.45);
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: #000c1f;
}

.hero-banner-item {
    position: relative;
    max-height: 540px;
    background: #000c1f;
}

.hero-banner-link {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.hero-banner-img {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    display: block;
    transition: transform 6s cubic-bezier(0.25, 1, 0.5, 1);
}

@media (max-width: 767.98px) {
    .hero-banner-img {
        max-height: 320px;
        object-fit: cover;
    }
}

.hero-banner-item:hover .hero-banner-img {
    transform: scale(1.02);
}

.hero-banner-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 18, 51, 0.95) 0%, rgba(0, 31, 84, 0.75) 50%, transparent 100%);
    padding: 2.5rem 3rem 2rem;
    color: #ffffff;
    text-align: left;
    z-index: 2;
}

@media (max-width: 767.98px) {
    .hero-banner-caption {
        padding: 1.25rem 1rem 1.5rem;
    }
}

.hero-carousel .carousel-indicators,
.hero-banner-carousel .carousel-indicators {
    bottom: 1rem;
    margin-bottom: 0;
    gap: 8px;
    z-index: 3;
}

.hero-carousel .carousel-indicators [data-bs-target],
.hero-banner-carousel .carousel-indicators [data-bs-target] {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.45);
    border: none;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hero-carousel .carousel-indicators .active,
.hero-banner-carousel .carousel-indicators .active {
    width: 32px;
    border-radius: 6px;
    background: var(--faculty-accent-gradient);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
}

.hero-control-btn {
    width: 44px;
    height: 44px;
    background: rgba(0, 18, 51, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.85;
    transition: all 0.25s ease;
    z-index: 3;
}

.hero-control-btn:hover {
    background: var(--faculty-accent-gradient);
    color: #001233;
    border-color: transparent;
    opacity: 1;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

/* ==========================================================================
   Hero Vision & Stats Section
   ========================================================================== */
.hero-vision-card {
    background: linear-gradient(135deg, #001233 0%, #001f54 60%, #0a3366 100%);
    color: #ffffff;
    border-radius: var(--faculty-radius-lg);
    border: 1px solid rgba(212, 175, 55, 0.35);
    padding: 3rem;
    box-shadow: 0 16px 40px rgba(0, 31, 84, 0.2);
    position: relative;
    overflow: hidden;
}

@media (max-width: 767.98px) {
    .hero-vision-card {
        padding: 2rem 1.5rem;
    }
}

.hero-vision-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero-stat-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: var(--faculty-radius);
    padding: 1.25rem 1rem;
    text-align: center;
    transition: all 0.25s ease;
}

.hero-stat-card:hover {
    background: rgba(212, 175, 55, 0.18);
    border-color: rgba(212, 175, 55, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.hero-stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--faculty-accent-light);
    line-height: 1;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.hero-stat-label {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin: 0;
    font-weight: 500;
}

/* Category Quick Filter Pills */
.category-quick-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 50px;
    background: #ffffff;
    color: var(--faculty-primary);
    border: 1px solid var(--faculty-border);
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 2px 8px rgba(0, 31, 84, 0.04);
    cursor: pointer;
    user-select: none;
}

.category-quick-pill:hover {
    background: var(--faculty-primary-subtle);
    color: var(--faculty-primary);
    border-color: var(--faculty-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 31, 84, 0.12);
}

.category-quick-pill.active {
    background: var(--faculty-primary);
    color: #ffffff;
    border-color: var(--faculty-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 31, 84, 0.25);
    font-weight: 600;
}

.category-quick-pill.active::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--faculty-accent);
    border-radius: 50%;
    margin-left: 2px;
}

/* Home News Dynamic Filter Loading & Animations */
.home-news-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--faculty-radius);
    transition: opacity 0.2s ease;
}

.transition-fade {
    transition: opacity 0.25s ease;
}

@keyframes newsGridItemFadeIn {
    0% {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-fade-in {
    animation: newsGridItemFadeIn 0.35s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.news-grid-col:nth-child(1) { animation-delay: 0.03s; }
.news-grid-col:nth-child(2) { animation-delay: 0.07s; }
.news-grid-col:nth-child(3) { animation-delay: 0.11s; }
.news-grid-col:nth-child(4) { animation-delay: 0.15s; }
.news-grid-col:nth-child(5) { animation-delay: 0.19s; }
.news-grid-col:nth-child(6) { animation-delay: 0.23s; }

/* ==========================================================================
   News Card Component
   ========================================================================== */
.news-card {
    background: #ffffff;
    border: 1px solid var(--faculty-border);
    border-radius: var(--faculty-radius);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--faculty-shadow-sm);
}

.news-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(0, 31, 84, 0.12), 0 0 0 1px rgba(212, 175, 55, 0.4);
    border-color: rgba(212, 175, 55, 0.5);
}

.news-card-img-wrap {
    height: 210px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #001233 0%, #001f54 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.news-card:hover .news-card-img-wrap img {
    transform: scale(1.06);
}

.news-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #001f54, #001233);
    color: rgba(212, 175, 55, 0.5);
    font-size: 2.5rem;
}

.news-card-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.news-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-title a {
    color: var(--faculty-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.news-card-title a:hover {
    color: var(--faculty-accent-hover);
}

.news-card-excerpt {
    color: var(--faculty-text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-meta {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--faculty-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--faculty-text-muted);
}

.category-badge {
    display: inline-block;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 50px;
    background-color: var(--faculty-primary-subtle);
    color: var(--faculty-primary);
    text-decoration: none;
    border: 1px solid rgba(13, 59, 117, 0.2);
    transition: all 0.2s ease;
}

.category-badge:hover {
    background: var(--faculty-accent-gradient);
    color: #001233;
    border-color: transparent;
}

/* ==========================================================================
   Buttons & UI Elements (Navy Blue & Imperial Gold)
   ========================================================================== */
.btn-faculty-primary {
    background: linear-gradient(135deg, var(--faculty-primary) 0%, var(--faculty-primary-light) 100%);
    color: #ffffff;
    border: 1px solid rgba(212, 175, 55, 0.3);
    font-weight: 500;
    padding: 10px 22px;
    border-radius: var(--faculty-radius-sm);
    transition: all 0.25s ease;
}

.btn-faculty-primary:hover {
    background: linear-gradient(135deg, var(--faculty-primary-light) 0%, #0d4a94 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 31, 84, 0.25);
    transform: translateY(-1px);
}

.btn-faculty-gold {
    background: var(--faculty-accent-gradient);
    color: #001233;
    border: none;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: var(--faculty-radius-sm);
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
    transition: all 0.25s ease;
}

.btn-faculty-gold:hover {
    background: linear-gradient(135deg, #fde047 0%, #eab308 100%);
    color: #001233;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    transform: translateY(-2px);
}

.btn-faculty-outline {
    background-color: transparent;
    color: var(--faculty-primary);
    border: 1.5px solid var(--faculty-primary);
    font-weight: 500;
    padding: 9px 20px;
    border-radius: var(--faculty-radius-sm);
    transition: all 0.2s ease;
}

.btn-faculty-outline:hover {
    background-color: var(--faculty-primary);
    color: #ffffff;
}

/* ==========================================================================
   News Detail Page
   ========================================================================== */
.news-detail-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--faculty-border);
    padding: 40px 0 30px;
}

.news-detail-title {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--faculty-primary);
    margin-bottom: 20px;
}

.news-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    color: var(--faculty-text-muted);
    font-size: 0.95rem;
}

.news-content {
    font-size: 1.12rem;
    line-height: 1.85;
    color: #334155;
}

.news-content p {
    margin-bottom: 1.5rem;
}

.news-content img {
    max-width: 100%;
    height: auto !important;
    object-fit: contain;
    border-radius: var(--faculty-radius-sm);
    box-shadow: var(--faculty-shadow-sm);
    margin: 1rem 0;
}

/* ==========================================================================
   Dashboard Styles
   ========================================================================== */
.dashboard-wrapper {
    display: flex;
    min-height: calc(100vh - 60px);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.dashboard-sidebar {
    width: 260px;
    background: var(--faculty-primary-dark);
    color: #cbd5e1;
    flex-shrink: 0;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(212, 175, 55, 0.2);
}

.dashboard-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--faculty-radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.dashboard-nav-item:hover, .dashboard-nav-item.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--faculty-accent-light);
    border-left: 3px solid var(--faculty-accent);
}

.dashboard-content {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    background-color: #f8fafc;
    padding: 32px;
    overflow-x: hidden;
}

.dashboard-content .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .dashboard-content {
        padding: 18px 12px;
    }
}

.metric-card {
    background: #ffffff;
    border: 1px solid var(--faculty-border);
    border-radius: var(--faculty-radius);
    padding: 24px;
    box-shadow: var(--faculty-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* ==========================================================================
   Footer (Navy Midnight with Radiant Gold Accent)
   ========================================================================== */
.faculty-footer {
    background: linear-gradient(180deg, #001233 0%, #000c1f 100%);
    color: #cbd5e1;
    padding: 55px 0 25px;
    border-top: 4px solid var(--faculty-accent);
}

.footer-heading {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-heading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 38px;
    height: 3px;
    background: var(--faculty-accent-gradient);
    border-radius: 2px;
}

.footer-link {
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.footer-link:hover {
    color: var(--faculty-accent);
    transform: translateX(4px);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 991.98px) {
    .dashboard-wrapper {
        flex-direction: column;
    }
    .dashboard-sidebar {
        width: 100%;
        padding: 16px;
    }
    .news-detail-title {
        font-size: 1.75rem;
    }
    .navbar-search-wrapper {
        width: 100%;
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }
    .navbar-search-dropdown {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ==========================================================================
   Real-Time Live Search (Navbar Dropdown)
   ========================================================================== */
.navbar-search-wrapper {
    position: relative;
    width: 270px;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 1200px) {
    .navbar-search-wrapper:focus-within {
        width: 340px;
    }
}

.navbar-search-group {
    background: #ffffff;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(0, 31, 84, 0.08);
    transition: all 0.25s ease;
    border: 1px solid var(--faculty-border);
}

.navbar-search-group:focus-within {
    box-shadow: 0 4px 16px rgba(13, 59, 117, 0.2);
    border-color: var(--faculty-primary-light);
}

.navbar-search-input {
    font-size: 0.88rem;
    background-color: transparent !important;
    padding-left: 6px;
    color: var(--faculty-text-dark);
}

.navbar-search-input::-webkit-search-decoration,
.navbar-search-input::-webkit-search-cancel-button,
.navbar-search-input::-webkit-search-results-button,
.navbar-search-input::-webkit-search-results-decoration {
    display: none;
    -webkit-appearance: none;
}

.navbar-search-input:focus {
    box-shadow: none !important;
}

.navbar-search-clear-btn {
    color: #9ca3af;
    font-size: 0.9rem;
    padding: 0 6px;
    background: transparent;
}

.navbar-search-clear-btn:hover {
    color: #ef4444;
}

.navbar-search-submit-btn {
    background-color: var(--faculty-primary) !important;
    border-color: var(--faculty-primary) !important;
    color: #ffffff !important;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.navbar-search-submit-btn:hover {
    background-color: var(--faculty-primary-light) !important;
    border-color: var(--faculty-primary-light) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(13, 59, 117, 0.3);
}

/* Live Search Dropdown Panel */
.navbar-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 390px;
    max-width: 92vw;
    background: #ffffff;
    border: 1px solid var(--faculty-border);
    box-shadow: 0 16px 36px rgba(0, 31, 84, 0.18), 0 4px 12px rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    z-index: 1060;
    overflow: hidden;
    animation: liveSearchSlideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes liveSearchSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.live-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--faculty-bg-alt);
    border-bottom: 1px solid var(--faculty-border);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--faculty-primary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.live-search-count-badge {
    background: var(--faculty-accent-gradient);
    color: #001233;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.live-search-list {
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--faculty-border) transparent;
}

.live-search-list::-webkit-scrollbar {
    width: 6px;
}
.live-search-list::-webkit-scrollbar-thumb {
    background-color: var(--faculty-border);
    border-radius: 10px;
}

.live-search-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--faculty-text-dark);
    border-bottom: 1px solid #edf3fa;
    transition: background-color 0.15s ease, transform 0.15s ease;
    cursor: pointer;
}

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

.live-search-item:hover,
.live-search-item.is-selected {
    background-color: var(--faculty-primary-subtle);
    color: var(--faculty-primary-dark);
}

.live-search-thumb {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    background: #001233;
    border: 1px solid #dbe4f0;
}

.live-search-thumb-placeholder {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    background: #edf3fa;
    color: var(--faculty-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.3rem;
}

.live-search-body {
    flex: 1;
    min-width: 0;
}

.live-search-title {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 4px;
    color: var(--faculty-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.live-search-item:hover .live-search-title,
.live-search-item.is-selected .live-search-title {
    color: var(--faculty-primary-light);
}

.live-search-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.74rem;
    color: var(--faculty-text-muted);
}

.live-search-cat-badge {
    background-color: rgba(0, 31, 84, 0.08);
    color: var(--faculty-primary);
    padding: 1px 7px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.72rem;
    white-space: nowrap;
}

.live-search-highlight {
    background: #fef08a;
    color: #854d0e;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 700;
}

.live-search-footer {
    padding: 10px 16px;
    background: var(--faculty-bg-alt);
    border-top: 1px solid var(--faculty-border);
    text-align: center;
}

.live-search-view-all {
    display: block;
    color: var(--faculty-primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.15s ease, transform 0.15s ease;
}

.live-search-view-all:hover {
    color: var(--faculty-accent-hover);
    transform: translateX(2px);
}

.live-search-empty {
    padding: 28px 20px;
    text-align: center;
    color: var(--faculty-text-muted);
}

.live-search-empty i {
    font-size: 2.2rem;
    color: #93c5fd;
    margin-bottom: 8px;
    display: block;
}

.live-search-empty p {
    font-size: 0.88rem;
    margin: 0;
}

/* ==========================================================================
   Back to Top Floating Button with Circular Progress
   ========================================================================== */
.back-to-top-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 31, 84, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 8px 24px rgba(0, 31, 84, 0.35), 0 0 16px rgba(212, 175, 55, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.85);
    transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                visibility 0.35s,
                box-shadow 0.3s ease,
                border-color 0.3s ease,
                background-color 0.3s ease;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

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

.back-to-top-btn:hover {
    background: rgba(0, 24, 66, 0.95);
    border-color: var(--faculty-accent);
    box-shadow: 0 10px 30px rgba(0, 31, 84, 0.5), 0 0 24px rgba(212, 175, 55, 0.45);
    transform: translateY(-4px) scale(1.06);
}

.back-to-top-btn:active {
    transform: translateY(-1px) scale(0.96);
    box-shadow: 0 4px 15px rgba(0, 31, 84, 0.4);
}

/* Circular Progress SVG */
.back-to-top-btn .progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    transform: rotate(-90deg);
    pointer-events: none;
}

.back-to-top-btn .progress-ring-bg {
    stroke: rgba(255, 255, 255, 0.15);
}

.back-to-top-btn .progress-ring-circle {
    stroke: var(--faculty-accent);
    stroke-linecap: round;
    stroke-dasharray: 125.66;
    stroke-dashoffset: 125.66;
    transition: stroke-dashoffset 0.1s linear;
}

/* Icon & Dynamic Floating Animation */
.back-to-top-btn .btn-icon {
    position: relative;
    z-index: 2;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, color 0.25s ease;
}

.back-to-top-btn:hover .btn-icon {
    color: var(--faculty-accent);
    animation: topBtnGlide 1s infinite alternate ease-in-out;
}

@keyframes topBtnGlide {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-3px);
    }
}

/* Mobile Responsive */
@media (max-width: 575.98px) {
    .back-to-top-btn {
        bottom: 20px;
        right: 18px;
        width: 44px;
        height: 44px;
    }

    .back-to-top-btn .progress-ring {
        width: 44px;
        height: 44px;
    }

    .back-to-top-btn .btn-icon {
        font-size: 1.1rem;
    }
}


/* ==========================================================================
   CMS Pages — หน้าเว็บเพจ (ADR 0001) + แถบพรีวิว + เมนูจากฐานข้อมูล (ADR 0002)
   ========================================================================== */

/* แถบเตือนโหมดพรีวิว (เจ้าหน้าที่เท่านั้น) */
.preview-banner {
    background: repeating-linear-gradient(45deg, #b89120, #b89120 14px, #d4af37 14px, #d4af37 28px);
    color: #001233;
    font-weight: 600;
    font-size: 0.92rem;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.preview-banner .btn-gold-ghost {
    background: rgba(0, 18, 51, 0.85);
    color: #fae084;
    border: 1px solid rgba(0, 18, 51, 0.4);
}

.preview-banner .btn-gold-ghost:hover {
    background: #001233;
    color: #ffffff;
}

/* Hero ของหน้าเว็บเพจ — สอดคล้องภาษาภาพ hero-section หลัก */
.page-hero {
    position: relative;
    padding: 3.5rem 0 3rem;
    background: radial-gradient(circle at 85% 15%, rgba(212, 175, 55, 0.22) 0%, transparent 45%),
                linear-gradient(135deg, #001233 0%, #001f54 55%, #0a3366 100%);
    border-bottom: 3px solid var(--faculty-accent);
    overflow: hidden;
}

.page-hero.has-image .page-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: saturate(0.9);
}

.page-hero.has-image .page-hero-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 18, 51, 0.92) 0%, rgba(0, 18, 51, 0.55) 55%, rgba(0, 18, 51, 0.35) 100%);
}

.page-hero .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.45);
}

.page-hero-title {
    color: #ffffff;
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    margin-bottom: 0.35rem;
}

.page-hero-subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.05rem;
    margin-bottom: 0;
}

/* ตัวเนื้อหา rich text */
.page-body {
    padding: 3rem 0 1rem;
    background: var(--faculty-bg);
}

.page-content-card {
    background: var(--faculty-surface);
    border: 1px solid var(--faculty-border);
    border-radius: var(--faculty-radius-lg);
    box-shadow: var(--faculty-shadow-md);
    padding: clamp(1.5rem, 4vw, 3.25rem);
}

.page-content {
    color: var(--faculty-text-dark);
    font-size: 1.02rem;
    line-height: 1.85;
}

/* ธีมภายในเนื้อหา rich text ให้เข้ากับดีไซน์ navy & gold */
.page-content h2,
.page-content h3,
.page-content h4 {
    color: var(--faculty-primary);
    font-weight: 700;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.page-content h2 { font-size: 1.5rem; }
.page-content h3 { font-size: 1.25rem; }

.page-content p { margin-bottom: 1rem; }

.page-content a {
    color: var(--faculty-primary-light);
    text-decoration: underline;
    text-decoration-color: rgba(212, 175, 55, 0.6);
    text-underline-offset: 3px;
}

.page-content a:hover { color: var(--faculty-accent-hover); }

.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--faculty-radius);
    box-shadow: var(--faculty-shadow-sm);
    margin: 0.5rem 0;
}

.page-content ul,
.page-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }

.page-content li { margin-bottom: 0.35rem; }

.page-content blockquote {
    border-left: 4px solid var(--faculty-accent);
    background: var(--faculty-accent-soft);
    border-radius: 0 var(--faculty-radius) var(--faculty-radius) 0;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    color: var(--faculty-primary);
    font-style: normal;
}

.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: var(--faculty-radius-sm);
}

.page-content th,
.page-content td {
    border: 1px solid var(--faculty-border);
    padding: 0.65rem 0.9rem;
    text-align: left;
    vertical-align: top;
}

.page-content th {
    background: var(--faculty-primary);
    color: #ffffff;
    font-weight: 600;
}

.page-content tr:nth-child(even) td { background: var(--faculty-bg-alt); }

.page-content hr {
    border: 0;
    height: 2px;
    background: linear-gradient(to right, var(--faculty-accent), transparent);
    margin: 2rem 0;
}

.page-content pre {
    background: #001233;
    color: #dbe4f0;
    border-radius: var(--faculty-radius);
    padding: 1.25rem;
    overflow-x: auto;
}

.page-content :first-child { margin-top: 0; }

@media (max-width: 767.98px) {
    .page-hero { padding: 2.25rem 0 2rem; }
    .page-body { padding: 2rem 0 1rem; }
}

/* Footer แบบมืออาชีพ — คอลัมน์เมนูจากระบบจัดการ (ADR 0002) */
.footer-menu-grid .footer-heading {
    font-size: 0.98rem;
    margin-bottom: 0.85rem;
}

.footer-menu-grid .footer-heading a {
    color: #ffffff;
    text-decoration: none;
}

.footer-menu-grid .footer-heading a:hover,
.footer-menu-grid .footer-heading a.active {
    color: var(--faculty-accent);
}

.footer-link {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    transition: color 0.18s ease, padding-left 0.18s ease;
}

.footer-link:hover,
.footer-link.active {
    color: var(--faculty-accent-light);
    padding-left: 4px;
}

.footer-divider {
    border: 0;
    border-top: 1px solid rgba(212, 175, 55, 0.25);
    opacity: 1;
}

.footer-sep {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    opacity: 1;
    margin: 0;
}

.footer-social {
    border-color: rgba(212, 175, 55, 0.45);
    color: var(--faculty-accent-light);
}

.footer-social:hover {
    background: var(--faculty-accent-gradient);
    border-color: transparent;
    color: #001233;
}

@media (max-width: 767.98px) {
    .footer-menu-grid .footer-heading { font-size: 0.92rem; }
}
