/*
 * =============================================
 * School CMS - Main Stylesheet
 * Theme: Blue-Orange (matching singsamut layout)
 * Upgraded: Bootstrap 5, modern CSS
 * =============================================
 */

/* ===== RESET & BASE ===== */
:root {
    --primary: #1a009e;
    --primary-dark: #12006e;
    --primary-light: #3d2bb5;
    --secondary: #1d8bc7;
    --secondary-dark: #156a9b;
    --accent: #f17d00;
    --accent-light: #ff9a2e;
    --bg-light: #f5f7fa;
    --bg-dark: #0d0b2e;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --white: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

body {
    font-family: 'Noto Sans Thai', 'Segoe UI', Tahoma, sans-serif;
    color: var(--text-dark);
    background: var(--bg-light);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

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

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

/* ===== TOP BAR ===== */
.top-bar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: rgba(255,255,255,0.9);
    padding: 6px 0;
    font-size: 0.82rem;
}

.top-bar-text {
    color: rgba(255,255,255,0.85);
}

.top-bar-text i {
    margin-right: 4px;
    color: var(--accent);
}

.top-bar-social {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    margin-left: 6px;
    font-size: 0.75rem;
}

.top-bar-social:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
}

/* ===== HEADER ===== */
.site-header {
    background: var(--white);
    padding: 12px 0;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-img {
    max-height: 70px;
    width: auto;
}

.logo-icon-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.8rem;
}

.header-school-name {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.header-school-name-th {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
}

.header-school-name-en {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo-text i {
    font-size: 2rem;
    color: var(--accent);
}

/* ===== NAVIGATION ===== */
.main-nav {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 4px 15px rgba(26, 0, 158, 0.3);
}

.main-nav .container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nav-menu {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-item {
    position: relative;
}

.nav-item > a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.9);
    font-size: 0.92rem;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
}

.nav-item > a .dropdown-arrow {
    font-size: 0.6rem;
    transition: transform 0.3s ease;
}

.nav-item > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-item > a:hover,
.nav-item.active > a {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.nav-item > a:hover::after,
.nav-item.active > a::after {
    width: 60%;
}

/* Dropdown Menu */
.nav-item .nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: var(--white);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-md);
    list-style: none;
    padding: 6px 0;
    margin: 0;
    z-index: 1000;
    animation: dropdownFadeIn 0.25s ease;
    border: none;
}

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

.nav-item.has-dropdown:hover > .nav-dropdown {
    display: block;
}

.nav-item.has-dropdown:hover > a .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-item .nav-dropdown li a {
    display: block;
    padding: 10px 20px;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item .nav-dropdown li a:hover {
    background: rgba(29, 139, 199, 0.08);
    color: var(--secondary);
    border-left-color: var(--accent);
    transform: translateX(4px);
}

/* Sub-dropdown (Level 3) */
.nav-item .nav-dropdown li.has-sub-dropdown {
    position: relative;
}

.nav-item .nav-dropdown .sub-dropdown {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 0;
    margin-top: -6px;
    min-width: 220px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    animation: dropdownFadeInSide 0.25s ease;
}

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

.nav-item .nav-dropdown li.has-sub-dropdown:hover > .sub-dropdown {
    display: block;
}

.nav-item .nav-dropdown li.has-sub-dropdown:hover > a .fa-chevron-right {
    color: var(--accent);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.nav-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    background: #fff;
    margin: 5px 0;
    border-radius: 3px;
    transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ===== HERO BANNER ===== */
.hero-banner {
    position: relative;
    overflow: hidden;
    background: var(--bg-dark);
}

.hero-banner .swiper-slide img {
    width: 100%;
    height: auto;
    display: block;
    min-height: 250px;
    object-fit: cover;
}

.hero-banner .swiper-pagination-bullet {
    background: rgba(255,255,255,0.6);
    opacity: 1;
    width: 12px;
    height: 12px;
}

.hero-banner .swiper-pagination-bullet-active {
    background: var(--accent);
    width: 30px;
    border-radius: 6px;
}

.hero-banner .swiper-button-next,
.hero-banner .swiper-button-prev {
    color: #fff;
    background: rgba(0,0,0,0.3);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    backdrop-filter: blur(4px);
}

.hero-banner .swiper-button-next::after,
.hero-banner .swiper-button-prev::after {
    font-size: 18px;
}

/* Empty hero placeholder */
.hero-empty {
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-align: center;
}

.hero-empty h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.hero-empty p {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* ===== QUICK LINKS (Circle Icon Nav) ===== */
.quick-links-section {
    position: relative;
    z-index: 10;
    margin-top: -60px;
    margin-bottom: 20px;
}

.quick-links-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
}

.quick-link-item {
    text-align: center;
    width: 110px;
    cursor: pointer;
    transition: var(--transition);
}

.quick-link-item:hover {
    transform: translateY(-8px);
}

.quick-link-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 10px;
    filter: drop-shadow(0 5px 15px rgba(27, 45, 78, 0.4));
    position: relative;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-link-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    clip-path: circle(50% at 50% 50%);
}

.quick-link-icon .placeholder-icon {
    font-size: 2rem;
    color: white;
}

.quick-link-icon::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    opacity: 0;
    transform: rotate(30deg);
    background: linear-gradient(to right, rgba(255,255,255,0.13) 0%, rgba(255,255,255,0.13) 77%, rgba(255,255,255,0.5) 92%, rgba(255,255,255,0) 100%);
}

.quick-link-item:hover .quick-link-icon::after {
    opacity: 1;
    left: 130%;
    transition: left 0.7s ease, opacity 0.15s ease;
}

.quick-link-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    background: rgba(0,0,0,0.55);
    padding: 4px 10px;
    border-radius: 6px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.quick-link-text span {
    display: block;
}

/* ===== SCHOOL MOTTO ===== */
.motto-section {
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    overflow: hidden;
    padding: 0;
}

.motto-section .motto-bg {
    width: 100%;
    height: auto;
    display: block;
}

.motto-overlay {
    position: relative;
    text-align: center;
    padding: 40px 20px;
    color: #fff;
    z-index: 1;
}

.motto-section.has-bg .motto-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.motto-label {
    font-size: 1.3rem;
    font-weight: 400;
    margin-bottom: 5px;
}

.motto-text {
    font-size: 1.8rem;
    font-weight: 600;
    font-style: italic;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ===== SECTION HEADERS ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary);
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: var(--accent);
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
}

.section-viewall a {
    color: var(--secondary);
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-viewall a:hover {
    color: var(--accent);
}

/* ===== CONTENT SECTIONS ===== */
.content-section {
    padding: 40px 0;
}

.content-section:nth-child(even) {
    background: var(--white);
}

.content-section.bg-primary-gradient {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.content-section.bg-primary-gradient .section-title {
    color: #fff;
}

.content-section.bg-primary-gradient .section-header {
    border-bottom-color: rgba(255,255,255,0.3);
}

.content-section.bg-primary-gradient .section-header::after {
    background: var(--accent);
}

/* ===== 3-COLUMN LAYOUT ===== */
.three-col-layout {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 25px;
    padding: 30px 0;
}

.sidebar-left,
.sidebar-right {
    min-width: 0;
}

.center-content {
    min-width: 0;
}

/* Sidebar Widgets */
.sidebar-widget {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
    border-left: 4px solid var(--primary-dark);
    transition: var(--transition);
}

.sidebar-widget:hover {
    box-shadow: var(--shadow-md);
}

.sidebar-widget-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    padding: 12px 15px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-widget-header i {
    font-size: 1rem;
    opacity: 0.9;
}

.sidebar-widget-body {
    padding: 15px;
}

.sidebar-link-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-link-item {
    margin-bottom: 4px;
}

.sidebar-link-item:last-child {
    margin-bottom: 0;
}

.sidebar-link-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    font-size: 0.88rem;
    transition: var(--transition);
    border-bottom: 1px solid #f0f2f5;
}

.sidebar-link-item:last-child a {
    border-bottom: none;
}

.sidebar-link-item a:hover {
    background: rgba(29, 139, 199, 0.08);
    color: var(--secondary);
    transform: translateX(4px);
}

.sidebar-link-item img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-link-item i {
    font-size: 0.85rem;
    width: 20px;
    text-align: center;
    color: var(--secondary);
    flex-shrink: 0;
}

/* ===== SIDEBAR DROPDOWN (has-children) ===== */
.sidebar-link-item.has-children > a.sidebar-parent-toggle {
    cursor: pointer;
    user-select: none;
    /* ดู เหมือน link ปกติ แต่ justify-content: space-between ให้ลูกศรอยู่ขวา */
    justify-content: space-between;
    font-weight: 500;
    color: var(--text-dark);
}

.sidebar-link-item.has-children > a.sidebar-parent-toggle:hover {
    background: rgba(29, 139, 199, 0.08);
    color: var(--secondary);
    transform: translateX(4px);
}

/* ลูกศรหมุน */
.sidebar-toggle-icon {
    font-size: 0.65rem !important;
    width: auto !important;
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-light) !important;
    transition: transform 0.3s ease, color 0.2s ease !important;
}

.sidebar-link-item.has-children.open > a.sidebar-parent-toggle {
    color: var(--primary);
    font-weight: 600;
    background: rgba(26, 0, 158, 0.05);
}

.sidebar-link-item.has-children.open > a.sidebar-parent-toggle .sidebar-toggle-icon {
    transform: rotate(180deg);
    color: var(--primary) !important;
}

/* Sub-list: ไม่มีพื้นหลังแตกต่าง เนียนไปกับ list เดิม */
.sidebar-sub-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
}

.sidebar-link-item.has-children.open > .sidebar-sub-list {
    display: block;
    animation: sidebarSubSlide 0.25s ease;
}

@keyframes sidebarSubSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Child links — indent เข้าไป ใช้ style เดียวกับ link ปกติ */
.sidebar-sub-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px 9px 26px;   /* indent ซ้าย 26px */
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    font-size: 0.85rem;
    transition: var(--transition);
    border-bottom: 1px solid #f0f2f5;
}

.sidebar-sub-list li:last-child a {
    border-bottom: none;
}

.sidebar-sub-list li a:hover {
    background: rgba(29, 139, 199, 0.08);
    color: var(--secondary);
    padding-left: 30px;
}

.sidebar-sub-list li a i {
    font-size: 0.72rem;
    color: var(--secondary);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* Social buttons in sidebar */
.sidebar-social-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-social-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #f8f9fa;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-social-btn:hover {
    background: var(--secondary);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-social-btn i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ===== NEWS / ARTICLE CARDS ===== */
.news-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

.news-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.news-card:hover .news-card-image img {
    transform: scale(1.08);
}

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

.news-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

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

.news-card-desc {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.news-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.news-card-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Featured news (large) */
.featured-news {
    position: relative;
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    background: var(--white);
    transition: var(--transition);
}

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

.featured-news img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.featured-news-content {
    padding: 20px 25px;
}

.featured-news-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.featured-news-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ===== STAFF CAROUSEL ===== */
.staff-carousel {
    background: var(--primary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.staff-carousel .swiper-slide img {
    width: 100%;
    height: auto;
}

.staff-carousel .swiper-pagination-bullet {
    background: rgba(255,255,255,0.5);
}

.staff-carousel .swiper-pagination-bullet-active {
    background: var(--accent);
}

/* Staff Slide with Overlay */
.staff-slide-inner {
    position: relative;
    overflow: hidden;
}

.staff-slide-inner img {
    width: 100%;
    height: auto;
    display: block;
}

.staff-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 12px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.staff-name {
    font-size: 0.9rem;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.staff-position {
    font-size: 0.75rem;
    opacity: 0.9;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.staff-phone {
    font-size: 0.72rem;
    opacity: 0.85;
    margin-top: 2px;
}

.staff-phone i {
    font-size: 0.65rem;
    margin-right: 3px;
    color: var(--accent);
}

/* ===== GALLERY CAROUSEL ===== */
.gallery-section {
    padding: 40px 0;
    background: var(--white);
}

.gallery-carousel .swiper-slide {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.gallery-carousel .swiper-slide img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s ease;
    cursor: pointer;
}

.gallery-carousel .swiper-slide:hover img {
    transform: scale(1.05);
}

/* ===== AWARDS SECTION ===== */
.awards-section {
    padding: 40px 0;
}

.awards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ===== FOOTER ===== */
.site-footer {
    position: relative;
    margin-top: 40px;
}

.footer-wave {
    position: relative;
    margin-bottom: -2px;
}

.footer-wave svg {
    display: block;
    width: 100%;
    height: 80px;
}

.footer-main {
    background: var(--primary);
    color: rgba(255,255,255,0.9);
    padding: 40px 0 30px;
}

.footer-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-title i {
    color: var(--accent);
}

.footer-desc {
    font-size: 0.88rem;
    line-height: 1.8;
    opacity: 0.85;
}

.footer-contact p {
    font-size: 0.88rem;
    margin-bottom: 5px;
    opacity: 0.85;
}

.footer-contact i {
    color: var(--accent);
    width: 18px;
    margin-right: 6px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 6px;
}

.footer-links a {
    color: rgba(255,255,255,0.8);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-links a i {
    font-size: 0.6rem;
    color: var(--accent);
}

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

.footer-social {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    transition: var(--transition);
}

.social-facebook { background: #1877f2; }
.social-youtube { background: #ff0000; }
.social-line { background: #06c755; }

.social-btn:hover {
    transform: translateY(-3px) scale(1.1);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Visitor Stats */
.visitor-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.visitor-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
}

.visitor-stat i {
    font-size: 1.3rem;
    color: var(--accent);
    width: 24px;
    text-align: center;
}

.stat-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: block;
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.7;
}

.footer-bottom {
    background: var(--primary-dark);
    padding: 12px 0;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
}

/* ===== WELCOME POPUP ===== */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.popup-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    z-index: 10000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-content img {
    width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.popup-close {
    position: absolute;
    top: -45px;
    right: -5px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(0,0,0,0.4);
    border: none;
    padding: 2px 12px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
}

.popup-close:hover {
    background: var(--accent);
    transform: rotate(90deg);
}

/* ===== FACEBOOK WIDGET ===== */
.fb-widget {
    padding: 0 !important;
    overflow: hidden;
}

.fb-widget iframe {
    display: block;
    width: 100%;
    border: none;
}

/* ===== PLACEHOLDER ===== */
.placeholder-img {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8e8e8, #f5f5f5);
    color: #bbb;
    font-size: 3rem;
    aspect-ratio: 16/9;
}

/* ===== RESPONSIVE ===== */
@media screen and (max-width: 1199px) {
    .three-col-layout {
        display: flex;
        flex-direction: column;
    }

    .sidebar-left {
        order: -2; /* Staff profiles (ผู้บริหาร) show first on mobile */
    }

    .center-content {
        order: -1; /* Display primary news/content before right sidebar */
    }

    .sidebar-left,
    .sidebar-right {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }

    .motto-text {
        font-size: 1.4rem;
    }
}

@media screen and (max-width: 991px) {
    .main-nav {
        min-height: 0;
        background: transparent;
        box-shadow: none;
    }

    .main-nav .container {
        min-height: 0;
    }

    .nav-toggle {
        display: block;
    }

    .nav-toggle span {
        background: var(--primary);
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        background: var(--primary);
        position: absolute;
        top: 0;
        left: 0;
        box-shadow: var(--shadow-md);
        z-index: 999;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-item > a {
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    /* Mobile Dropdown */
    .nav-item .nav-dropdown,
    .nav-item .nav-dropdown .sub-dropdown {
        position: static;
        display: none;
        background: rgba(0,0,0,0.15);
        box-shadow: none;
        border-radius: 0;
        animation: none;
        min-width: 100%;
        padding: 0;
        margin: 0;
    }

    .nav-item .nav-dropdown.show,
    .nav-item .nav-dropdown .sub-dropdown.show {
        display: block !important;
    }

    .nav-item.has-dropdown:hover > .nav-dropdown,
    .nav-item .nav-dropdown li.has-sub-dropdown:hover > .sub-dropdown {
        display: none;
    }

    .nav-item .nav-dropdown li a {
        color: rgba(255,255,255,0.85);
        padding: 10px 20px 10px 35px;
        border-left: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        font-size: 0.85rem;
    }

    .nav-item .sub-dropdown li a {
        padding-left: 50px;
        background: rgba(0,0,0,0.1);
    }

    .nav-item .nav-dropdown li a:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
        transform: none;
    }

    .main-nav .container {
        justify-content: flex-end;
    }

    .quick-links-section {
        margin-top: -40px;
    }

    .quick-link-item {
        width: 90px;
    }

    .quick-link-icon {
        width: 65px;
        height: 65px;
    }

    .awards-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .header-school-name-th {
        font-size: 1.1rem;
    }

    .header-school-name-en {
        font-size: 0.72rem;
    }
}

@media screen and (max-width: 767px) {
    .top-bar {
        display: none;
    }

    .quick-links-section {
        margin-top: -30px;
    }
    
    .quick-links-container {
        gap: 8px;
        padding: 0 10px;
        flex-wrap: nowrap; /* keep them in one row or allow wrap? The original design uses 4 links. Wrap is better if screen is super small. Actually let's just make them fit. */
    }

    .quick-link-item {
        flex: 1;
        min-width: 60px;
        max-width: 85px;
    }

    .quick-link-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 6px;
    }

    .quick-link-text {
        font-size: 0.65rem;
        padding: 4px 2px;
        word-break: break-word; /* Fix Thai text not wrapping */
        line-break: anywhere;
        white-space: normal;
        line-height: 1.2;
    }

    .quick-link-text span {
        display: block;
    }

    .motto-text {
        font-size: 1.1rem;
    }

    .motto-label {
        font-size: 1rem;
    }

    .hero-empty h2 {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .awards-grid {
        grid-template-columns: 1fr;
    }

    .content-section {
        padding: 25px 0;
    }

    .footer-main {
        padding: 30px 0 20px;
    }

    .header-school-name-th {
        font-size: 0.95rem;
    }

    .header-school-name-en {
        display: none;
    }

    .logo-img {
        max-height: 50px;
    }

    /* Popup responsive */
    .popup-content {
        width: 95%;
        max-width: 95vw;
    }

    .popup-close {
        top: -42px;
        right: 0;
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }
}

/* ===== SWIPER CUSTOM ===== */
.swiper {
    width: 100%;
}

.swiper-pagination {
    position: relative;
    margin-top: 15px;
}

/* ===== UTILITY ===== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-xl);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(241, 125, 0, 0.4);
    color: #fff;
}

/* ===== LOADING ===== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease;
}

.page-loader.loaded {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== SCROLL TO TOP ===== */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    border: none;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ===== ARTICLE BREADCRUMB ===== */
.article-breadcrumb {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 15px 0;
}

.article-breadcrumb .breadcrumb {
    font-size: 0.85rem;
}

.article-breadcrumb .breadcrumb-item a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition);
}

.article-breadcrumb .breadcrumb-item a:hover {
    color: #fff;
}

.article-breadcrumb .breadcrumb-item.active {
    color: rgba(255,255,255,0.6);
}

.article-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255,255,255,0.5);
}

/* ===== ARTICLE DETAIL PAGE ===== */
.article-page {
    padding: 40px 0 60px;
    background: var(--bg-light);
    min-height: 60vh;
}

.article-detail {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 35px;
    margin-bottom: 30px;
}

.article-category-badge a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border-radius: var(--radius-xl);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 15px;
    transition: var(--transition);
}

.article-category-badge a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26,0,158,0.3);
    color: #fff;
}

.article-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: 15px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--text-light);
}

.article-meta-item i {
    color: var(--secondary);
}

.article-featured-image {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

.article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-excerpt {
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(26,0,158,0.05), rgba(29,139,199,0.05));
    border-left: 4px solid var(--secondary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 25px;
}

.article-excerpt p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.7;
    font-style: italic;
}

.article-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-dark);
    margin-bottom: 30px;
}

.article-content p {
    margin-bottom: 15px;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 15px 0;
}

.article-content h2, .article-content h3, .article-content h4 {
    margin-top: 25px;
    margin-bottom: 15px;
    color: var(--primary);
}

.article-content ul, .article-content ol {
    padding-left: 25px;
    margin-bottom: 15px;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content blockquote {
    padding: 15px 20px;
    background: #f8f9fa;
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 20px 0;
    font-style: italic;
}

/* Share Buttons */
.article-share {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.share-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    color: #fff;
}

.share-facebook { background: #1877f2; }
.share-line { background: #06c755; }
.share-copy { background: var(--secondary); }

/* Related Articles */
.related-articles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-article-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--text-dark);
    text-decoration: none;
}

.related-article-item:hover {
    background: rgba(29, 139, 199, 0.08);
    transform: translateX(4px);
    color: var(--text-dark);
}

.related-article-thumb {
    width: 80px;
    min-width: 80px;
    height: 55px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.related-article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-img-sm {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #bbb;
    font-size: 1.2rem;
}

.related-article-info h5 {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.related-article-info small {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Sidebar active link */
.sidebar-link-item a.active {
    background: rgba(29, 139, 199, 0.15);
    color: var(--secondary);
    font-weight: 600;
}

/* ===== ARTICLES LISTING PAGE ===== */
.articles-page {
    padding: 40px 0 60px;
    background: var(--bg-light);
    min-height: 60vh;
}

.articles-page-header {
    margin-bottom: 25px;
}

.articles-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.articles-page-count {
    font-size: 0.88rem;
    color: var(--text-light);
    margin: 0;
    padding-left: 52px;
}

/* Category Tabs */
.articles-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.category-tab {
    padding: 8px 18px;
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
    background: var(--white);
    border: 1px solid #e0e0e0;
    transition: var(--transition);
    text-decoration: none;
}

.category-tab:hover {
    border-color: var(--secondary);
    color: var(--secondary);
    background: rgba(29, 139, 199, 0.05);
}

.category-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border-color: transparent;
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* News card category label */
.news-card-category {
    margin-bottom: 8px;
}

.news-card-category a {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--secondary);
    background: rgba(29, 139, 199, 0.1);
    padding: 3px 10px;
    border-radius: var(--radius-xl);
    transition: var(--transition);
}

.news-card-category a:hover {
    background: var(--secondary);
    color: #fff;
}

/* Pagination */
.articles-pagination {
    margin-top: 30px;
}

.articles-pagination .page-link {
    border: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 10px 16px;
    border-radius: var(--radius-sm) !important;
    margin: 0 3px;
    transition: var(--transition);
}

.articles-pagination .page-link:hover {
    background: rgba(29, 139, 199, 0.1);
    color: var(--secondary);
}

.articles-pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 12px rgba(26,0,158,0.3);
}

.articles-pagination .page-item.disabled .page-link {
    color: #ccc;
    background: transparent;
}

/* Empty State */
.articles-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
}

.articles-empty i {
    color: #ddd;
}

.articles-empty h3 {
    margin-top: 15px;
    color: var(--text-dark);
}

.articles-empty p {
    max-width: 400px;
    margin: 10px auto 0;
}

/* ===== DOCUMENTS REPOSITORY ===== */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.doc-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.doc-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
    border-color: var(--secondary);
}

.doc-card-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(0,0,0,0.03);
    border-radius: var(--radius-sm);
    transition: transform 0.3s ease;
}

.doc-card:hover .doc-card-icon {
    transform: scale(1.1);
}

.doc-card-body {
    flex: 1;
    min-width: 0; /* Prevents flex blowout */
    display: flex;
    flex-direction: column;
    height: 100%;
}

.doc-card-category {
    margin-bottom: 8px;
}

.doc-card-category span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--secondary);
    background: rgba(29, 139, 199, 0.1);
    padding: 3px 10px;
    border-radius: var(--radius-xl);
}

.doc-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.doc-card:hover .doc-card-title {
    color: var(--primary);
}

.doc-card-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.doc-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed #eaeaea;
}

.doc-card-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== ARTICLE RESPONSIVE ===== */
@media screen and (max-width: 991px) {
    .article-detail {
        padding: 25px 20px;
    }

    .article-title {
        font-size: 1.3rem;
    }

    .article-meta {
        flex-wrap: wrap;
        gap: 10px;
    }

    .article-share {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media screen and (max-width: 767px) {
    .article-page,
    .articles-page {
        padding: 25px 0 40px;
    }

    .article-detail {
        padding: 20px 15px;
    }

    .article-title {
        font-size: 1.15rem;
    }

    .articles-page-title {
        font-size: 1.2rem;
    }

    .articles-page-count {
        padding-left: 42px;
    }

    .articles-grid,
    .documents-grid {
        grid-template-columns: 1fr;
    }

    .articles-category-tabs {
        gap: 6px;
    }

    .category-tab {
        padding: 6px 14px;
        font-size: 0.8rem;
    }
}
