@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* ========================================= */
/* 1. Variables & Base Settings              */
/* ========================================= */
:root {
    --navy: #1C3A63;         /* น้ำเงินเข้ม */
    --blue: #4A90E2;         /* ฟ้าสว่าง */
    --light-blue: #F0F4F8;   /* สีพื้นหลังเว็บ */
    --white: #FFFFFF;
    --gold: #D4AF37;         /* สีทองลูกเล่น */
    --text-main: #334155;
    --text-light: #64748B;
    --border: #E2E8F0;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body { 
    font-family: 'Sarabun', sans-serif; 
    background-color: var(--light-blue); 
    color: var(--text-main); 
    line-height: 1.6; 
}

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

/* ========================================= */
/* 2. Navbar & Navigation (Desktop Layout)   */
/* ========================================= */
.navbar {
    position: fixed; 
    top: 15px;       
    left: 50%;       
    transform: translateX(-50%); 
    width: 95%; 
    max-width: 1400px;    
    background: linear-gradient(135deg, rgba(28, 58, 99, 0.9) 0%, rgba(42, 82, 135, 0.75) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); 
    border-radius: 50px; 
    padding: 0.6rem 2.5rem; 
    z-index: 1000;
    transition: var(--transition);
}

.navbar.scrolled { 
    top: 0; 
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    padding: 0.6rem 3rem; 
    background: linear-gradient(135deg, rgba(20, 43, 75, 0.95) 0%, rgba(28, 58, 99, 0.9) 100%);
    box-shadow: 0 10px 40px rgba(28, 58, 99, 0.3); 
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

.nav-menu-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;               
    margin-left: 2.5rem;   
}

/* --- [ฝั่งซ้าย] โลโก้องค์กร (Premium White Capsule) --- */
.nav-brand, .nav-logo { 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px; 
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(224, 242, 254, 0.9) 100%);
    border-radius: 50px; 
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), inset 0 0 10px rgba(74, 144, 226, 0.15);
    text-decoration: none; 
    position: relative;
    overflow: hidden;
    flex-shrink: 0; 
    transition: var(--transition);
}

.nav-brand-text, .logo-text {
    font-size: 1.4rem; 
    font-weight: 900;    
    background: linear-gradient(135deg, #1C3A63 0%, #2A5287 50%, #4A90E2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
    letter-spacing: 2px; 
}

.nav-brand::before, .nav-logo::before {
    content: '';
    position: absolute;
    top: 0; left: -150%; width: 50%; height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
}

.nav-brand:hover, .nav-logo:hover {
    transform: translateY(-1px); 
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.25), inset 0 0 12px rgba(74, 144, 226, 0.3);
    border-color: rgba(74, 144, 226, 0.4);
}
.nav-brand:hover::before, .nav-logo:hover::before { left: 150%; transition: all 0.7s ease-in-out; }

.brand-icon {
    height: 38px; 
    width: 38px;
    object-fit: contain; 
    border-radius: 50%; 
}

/* --- [ฝั่งกลาง] ชุดลิงก์เมนูหลัก --- */
.nav-links { 
    display: flex; 
    gap: 1rem; 
    align-items: center; 
    justify-content: center;
    margin: 0 auto; 
    white-space: nowrap;
}

.nav-links a.menu-item { 
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    padding: 8px 16px; 
    border-radius: 20px; 
    position: relative; 
    display: inline-block;
    transition: var(--transition);
    will-change: transform, color;
}

.nav-links a.menu-item:hover { 
    color: #FFFFFF !important; 
    background-color: rgba(74, 144, 226, 0.15); 
    transform: translateY(-1px); 
    box-shadow: inset 0 0 12px rgba(74, 144, 226, 0.1); 
}

.nav-links a.menu-item.active {
    color: #FFFFFF !important;
    background-color: rgba(123, 173, 230, 0.15);
}

/* --- [ฝั่งขวา] ระบบสมาชิก & ปุ่มล็อกอิน --- */
.auth-group, .nav-auth {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-shrink: 0; 
}

.login-link { 
    color: rgba(255, 255, 255, 0.9) !important; 
    font-weight: 600; 
    font-size: 0.95rem;
    padding: 8px 16px;
    transition: var(--transition); 
}
.login-link:hover { color: var(--blue) !important; transform: translateY(-1px); }

.register-btn, .btn-member { 
    background: var(--blue); 
    color: var(--white) !important; 
    padding: 10px 24px; 
    border-radius: 50px; 
    font-weight: 600; 
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.25); 
    transition: var(--transition); 
}
.register-btn:hover, .btn-member:hover { 
    background: #357ABD !important; 
    transform: translateY(-1px); 
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.35); 
}

/* บัญชีผู้ใช้งานระบบสไตล์แคปซูลกระจก */
.user-menu { position: relative; cursor: pointer; }

.user-name { 
    display: inline-flex;
    align-items: center; 
    gap: 10px; 
    font-weight: 600; 
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.92) !important; 
    padding: 6px 18px; 
    background: rgba(255, 255, 255, 0.08); 
    border: 1px solid rgba(255, 255, 255, 0.15); 
    border-radius: 50px; 
    transition: var(--transition); 
}
.user-name:hover { 
    background-color: rgba(74, 144, 226, 0.2); 
    border-color: rgba(74, 144, 226, 0.4); 
    color: #FFFFFF !important; 
    transform: translateY(-1px);
}
.user-name:hover .nav-avatar { color: #4A90E2; opacity: 1; }

.dropdown-content {
    display: none; position: absolute; right: 0; top: 120%;
    background: var(--white); min-width: 160px; border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15); overflow: hidden;
    opacity: 0; transform: translateY(-10px); transition: var(--transition);
    z-index: 1200;
}
.user-menu.active .dropdown-content { display: block; opacity: 1; transform: translateY(0); }
.dropdown-content a { display: block; padding: 12px 20px; color: var(--text-main); font-weight: 500; }
.dropdown-content a:hover { background-color: var(--light-blue); color: var(--navy); }

/* --- ระบบ Dropdown เมนูหลักหน้าเพจ --- */
.menu-dropdown-wrapper { position: relative; }
.arrow-down { font-size: 0.65rem; margin-left: 4px; opacity: 0.7; transition: transform 0.3s ease; }

.menu-dropdown-content {
    display: block;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(15px);
    min-width: 190px;
    background: linear-gradient(135deg, rgba(24, 43, 75, 0.98) 0%, rgba(28, 58, 99, 0.95) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease 0.1s, transform 0.25s ease 0.1s, visibility 0.25s 0.1s;
    z-index: 1100;
}
.menu-dropdown-content::before { content: ''; position: absolute; top: -20px; left: 0; width: 100%; height: 20px; background: transparent; }

.menu-dropdown-content a {
    color: rgba(255, 255, 255, 0.85);
    padding: 11px 20px;
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}
.menu-dropdown-content a:last-child { border-bottom: none; }
.menu-dropdown-content a:hover { background-color: rgba(74, 144, 226, 0.2); color: #FFFFFF !important; padding-left: 25px; }

.menu-dropdown-wrapper:hover .menu-dropdown-content {
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translateX(-50%) translateY(5px);
    transition: opacity 0.25s ease 0s, transform 0.25s ease 0s, visibility 0.25s 0s;
}
.menu-dropdown-wrapper:hover .arrow-down { transform: rotate(180deg); color: #FFFFFF; }

/* ========================================= */
/* 3. Hero Section & Opening Animations      */
/* ========================================= */
.hero-reveal {
    position: relative;
    height: 100vh; 
    min-height: 600px;
    background-color: var(--white); 
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; 
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: -15px; 
}

.hero-image-pale {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85)), url('../images/hero01.jpg');
    background-position: center; background-repeat: no-repeat; background-size: cover; background-attachment: fixed;
    z-index: 1;
    transition: opacity 0.5s ease;
}

.hero-image-clear-1, .hero-image-clear-2 {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(28, 58, 99, 0.3), rgba(28, 58, 99, 0.3)), url('../images/hero01.jpg');
    background-position: center; background-repeat: no-repeat; background-size: cover; background-attachment: fixed;
    z-index: 2;
    -webkit-clip-path: circle(0% at 50% 50%);
    clip-path: circle(0% at 50% 50%);
}

.hero-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 0.8fr 1.2fr; 
    align-items: center;
    gap: 80px;
    text-align: left;
}

.hero-text-side { display: flex; flex-direction: column; align-items: flex-start; }

.hero-content h1 { 
    font-size: 4rem; font-weight: 700; line-height: 1.15; margin-bottom: 1.5rem; color: var(--navy);
    animation: heroFadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) backwards; animation-delay: 0.2s;
}

.hero-content p { 
    font-size: 1.5rem; font-weight: 500; color: var(--text-light); max-width: 680px; margin: 0 0 2.5rem 0; line-height: 1.6; letter-spacing: 0.2px;
    animation: heroFadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) backwards; animation-delay: 0.4s;
}

.btn-primary-hero {
    display: inline-flex; align-items: center; justify-content: center; padding: 14px 36px;
    background-color: var(--blue); color: var(--white) !important; border-radius: 50px; font-size: 1.1rem; font-weight: 600;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3); transition: var(--transition);
    animation: heroFadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) backwards; animation-delay: 0.6s;
}
.btn-primary-hero:hover { background-color: var(--navy); transform: translateY(-3px); box-shadow: 0 8px 25px rgba(28, 58, 99, 0.25); }

.hero-image-side { display: flex; justify-content: center; align-items: center; }

.logo-animation-wrapper {
    position: relative; width: 420px; height: 420px; display: flex; justify-content: center; align-items: center;
    animation: heroScaleIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) backwards; animation-delay: 0.1s;
}

.hero-logo-display {
    position: relative; z-index: 3; width: 100%; max-width: 300px; height: auto; border-radius: 50%; object-fit: contain;
    filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.1)); animation: floatAnimation 6s ease-in-out infinite;
}

.rotating-ring { position: absolute; border-radius: 50%; border: 2px dashed rgba(74, 144, 226, 0.4); z-index: 2; }
.ring-1 { width: 360px; height: 360px; border-top-color: var(--navy); border-bottom-color: var(--gold); animation: rotateClockwise 20s linear infinite; }
.ring-2 { width: 400px; height: 400px; border-left-color: var(--blue); border-right-color: transparent; border-style: dotted; animation: rotateCounterClockwise 15s linear infinite; }

.connection-bg { position: absolute; width: 280px; height: 280px; background: radial-gradient(circle, rgba(74, 144, 226, 0.15) 0%, rgba(28, 58, 99, 0) 70%); border-radius: 50%; z-index: 1; }
.connection-bg::before, .connection-bg::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border: 1px solid rgba(74, 144, 226, 0.3); border-radius: 50%; animation: networkPulse 3s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite; }
.connection-bg::after { animation-delay: 1.5s; }

/* Active Animations State (Scroll Reveal) */
.hero-reveal.active-view .hero-content h1 { color: var(--white); }
.hero-reveal.active-view .hero-content p { color: #F1F5F9; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }
.hero-reveal.active-view .rotating-ring { border-color: rgba(255, 255, 255, 0.3); }

@keyframes heroFadeInUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes heroScaleIn { from { opacity: 0; transform: scale(0.85) rotate(-3deg); } to { opacity: 1; transform: scale(1) rotate(0deg); } }
@keyframes floatAnimation { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes rotateClockwise { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rotateCounterClockwise { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes networkPulse { 0% { transform: scale(0.9); opacity: 0.8; } 100% { transform: scale(1.6); opacity: 0; } }

/* ========================================= */
/* 4. Main Layout, Auth Systems & Forms      */
/* ========================================= */
.container { max-width: 1200px; margin: 3rem auto; padding: 0 20px; min-height: 70vh; }

.auth-container-wrapper {
    width: 100%;
    padding-top: 130px; 
    padding-bottom: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px); 
}

.auth-card {
    background: var(--white);
    width: 100%;
    max-width: 480px; 
    margin: 0 auto;
    padding: 3.5rem 2.5rem;
    border-radius: 24px; 
    box-shadow: 0 20px 40px rgba(28, 58, 99, 0.08); 
    border: 1px solid rgba(226, 232, 240, 0.8);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.auth-card.register-card { max-width: 720px; }
.auth-card h2 { color: var(--navy); text-align: center; margin-bottom: 2rem; font-weight: 700; font-size: 1.8rem; }

.form-group { margin-bottom: 1.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-main); font-weight: 500; }

.form-control {
    width: 100%; padding: 0.75rem 1.2rem; border: 1px solid var(--border);
    border-radius: 50px; outline: none; background-color: #F8FAFC;
    font-family: inherit; transition: var(--transition);
}
.form-control:focus { background-color: var(--white); border-color: var(--blue); box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15); }

.btn-primary {
    display: inline-block; width: 100%; padding: 0.85rem; text-align: center;
    background-color: var(--navy); color: var(--white); border: none; border-radius: 50px;
    font-size: 1rem; font-weight: 600; cursor: pointer; box-shadow: 0 4px 15px rgba(28, 58, 99, 0.15); transition: var(--transition);
}
.btn-primary:hover { background-color: var(--blue); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3); }

/* กล่องแจ้งเตือนภัยระบบแฮชและฟรอนต์เอนด์ */
.auth-alert-box {
    display: flex; align-items: center; gap: 12px; padding: 0.85rem 1.5rem; border-radius: 50px; margin-bottom: 1.8rem;
    background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.25); color: #DC2626; 
    font-size: 0.95rem; font-weight: 500; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.05);
    animation: fadeInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; }
.alert-text { line-height: 1.4; }

/* ========================================= */
/* 5. Home Content Cards & Swiper Slider     */
/* ========================================= */
.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }
.section-title { color: var(--navy); font-size: 1.8rem; font-weight: 700; border-left: 5px solid var(--blue); padding-left: 15px; }
.view-all { color: var(--blue); font-weight: 600; transition: var(--transition); }
.view-all:hover { color: var(--navy); }

.event-card, .post-card { 
    background: var(--white); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; height: 100%; border: 1px solid var(--border); 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: var(--transition); 
}
.event-card:hover, .post-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(28, 58, 99, 0.15); border-color: var(--blue); }
.event-img { width: 100%; height: 200px; object-fit: cover; }
.post-img { width: 100%; height: 180px; object-fit: cover; }

.event-info, .post-content { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; align-items: flex-start; }
.event-date { display: inline-block; background: var(--light-blue); color: var(--blue); padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; }
.post-category { color: var(--gold); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.event-info h3, .post-content h4 { color: var(--navy); margin-bottom: 0.5rem; line-height: 1.4; }
.event-info h3 { font-size: 1.2rem; }
.post-content h4 { font-size: 1.1rem; margin: 0.5rem 0; }
.event-info p, .post-content p { color: var(--text-light); margin-bottom: 1.5rem; }
.event-info p { font-size: 0.95rem; }
.post-content p { font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.btn-outline { display: inline-block; padding: 8px 20px; border: 2px solid var(--blue); color: var(--blue); border-radius: 6px; font-weight: 600; transition: var(--transition); text-align: center; width: 100%; margin-top: auto; }
.btn-outline:hover { background: var(--blue); color: var(--white); }
.read-more { color: var(--blue); font-weight: 600; font-size: 0.95rem; margin-top: auto; }
.read-more:hover { color: var(--navy); text-decoration: underline; }

.swiper-slide { height: auto; }
.swiper { padding-bottom: 40px !important; }
.swiper-button-next, .swiper-button-prev { color: var(--navy) !important; background: rgba(255,255,255,0.8); width: 40px !important; height: 40px !important; border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,0.1); z-index: 100; }
.swiper-button-next:after, .swiper-button-prev:after { font-size: 18px !important; font-weight: bold; }
.swiper-pagination-bullet-active { background: var(--blue) !important; }

/* ========================================= */
/* 6. Member Custom Sub-Pages (Inner Content)*/
/* ========================================= */

/* --- 6.1 หน้า Benefits (สิทธิประโยชน์) --- */
.page-header-section { text-align: center; margin-top: 145px; margin-bottom: 3.5rem; animation: heroFadeInUp 0.8s ease; }
.page-main-title { font-size: 2.4rem; font-weight: 700; color: var(--navy); margin-bottom: 0.5rem; }
.page-sub-title { font-size: 1.1rem; color: var(--text-light); }

.benefits-grid-container {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; max-width: 1100px; margin: 0 auto 5rem auto;
    animation: heroFadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s backwards;
}
.benefit-premium-card { background: var(--white); border-radius: 24px; padding: 3.5rem 2.5rem; border: 1px solid rgba(226, 232, 240, 0.8); box-shadow: 0 15px 35px rgba(28, 58, 99, 0.05); position: relative; overflow: hidden; transition: var(--transition); }
.benefit-premium-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(28, 58, 99, 0.1); }
.benefit-premium-card.ordinary-card { border-top: 5px solid var(--blue); }
.benefit-premium-card.associate-card { border-top: 5px solid var(--text-light); }

.card-badge-type { position: absolute; top: 20px; right: 25px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 4px 12px; border-radius: 20px; }
.ordinary-card .card-badge-type { background: rgba(74, 144, 226, 0.1); color: var(--blue); }
.associate-card .card-badge-type { background: #F1F5F9; color: var(--text-light); }
.benefit-premium-card h3 { font-size: 1.5rem; color: var(--navy); font-weight: 700; margin-bottom: 1rem; }
.card-divider { height: 1px; background: #E2E8F0; margin-bottom: 2rem; }

.benefit-feature-list { list-style: none; display: flex; flex-direction: column; gap: 1.5rem; }
.benefit-feature-list li { display: flex; align-items: flex-start; gap: 14px; }
.feature-icon-wrap { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.feature-icon-wrap svg { width: 12px; height: 12px; }
.check-success { background: #DCFCE7; color: #16A34A; }
.check-info { background: #E0F2FE; color: #0369A1; }
.feature-text { font-size: 1.05rem; color: var(--text-main); line-height: 1.5; }
.feature-text strong { color: var(--navy); font-weight: 600; }

/* --- 6.2 หน้า Publication (ตารางงานวิจัย) --- */
.publication-container { max-width: 1200px; margin: 145px auto 5rem auto; padding: 0 24px; animation: heroFadeInUp 0.8s ease; }
.pub-main-title { font-size: 2.4rem; font-weight: 700; color: var(--navy); margin-bottom: 2.5rem; position: relative; display: inline-block; }
.pub-main-title::after { content: ''; position: absolute; bottom: -8px; left: 0; width: 60px; height: 4px; background-color: var(--blue); border-radius: 10px; }

.pub-table-card { background: var(--white); border-radius: 24px; border: 1px solid rgba(226, 232, 240, 0.8); box-shadow: 0 20px 40px rgba(28, 58, 99, 0.04); padding: 2.5rem; }
.pub-search-wrapper { display: flex; justify-content: flex-end; margin-bottom: 2rem; }
.pub-search-box { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 50px; overflow: hidden; width: 100%; max-width: 340px; background-color: #F8FAFC; padding-left: 6px; transition: var(--transition); }
.pub-search-box:focus-within { background-color: var(--white); border-color: var(--blue); box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15); }
.pub-search-box input { border: none; outline: none; padding: 10px 14px; width: 100%; font-size: 0.95rem; font-family: inherit; background: transparent; color: var(--text-main); }
.pub-search-btn { background-color: var(--blue); border: none; color: var(--white); width: 38px; height: 38px; border-radius: 50%; margin: 3px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.pub-search-btn:hover { background-color: var(--navy); transform: scale(1.05); }
.pub-search-btn svg { width: 15px; height: 15px; }

.table-responsive-wrapper { width: 100%; overflow-x: auto; border-radius: 16px; border: 1px solid var(--border); }
.pub-data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.95rem; }
.pub-data-table th { background: linear-gradient(135deg, #1C3A63 0%, #2A5287 100%); color: var(--white); font-weight: 600; padding: 16px 20px; letter-spacing: 0.5px; text-transform: uppercase; font-size: 0.85rem; }
.pub-data-table td { padding: 18px 20px; border-bottom: 1px solid var(--border); line-height: 1.6; vertical-align: middle; }
.pub-data-table tbody tr:nth-child(even) { background-color: #F8FAFC; }
.pub-data-table tbody tr:hover { background-color: rgba(74, 144, 226, 0.04); }

.col-category strong { display: inline-block; padding: 4px 14px; background-color: rgba(74, 144, 226, 0.1); color: var(--blue); border-radius: 20px; font-size: 0.85rem; font-weight: 600; }
.col-name { color: var(--text-main); font-weight: 500; }
.col-link a { color: var(--blue); word-break: break-all; font-weight: 500; transition: var(--transition); }
.col-link a:hover { color: var(--navy); text-decoration: underline; }
.col-year { color: var(--text-light); font-weight: 600; }

/* ========================================= */
/* 7. Footer & Utilities                     */
/* ========================================= */
footer { background-color: var(--navy); color: var(--white); text-align: center; padding: 2rem 5%; margin-top: 4rem; }
.footer-content { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
footer p { color: #94A3B8; font-size: 0.9rem; }

#backToTop {
    position: fixed; bottom: 30px; right: 30px; width: 45px; height: 45px;
    background-color: var(--navy); color: var(--white); border: none; border-radius: 50%;
    cursor: pointer; opacity: 0; visibility: hidden; transition: var(--transition);
    display: flex; justify-content: center; align-items: center; font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 999;
}
#backToTop.visible { opacity: 1; visibility: visible; }
#backToTop:hover { transform: translateY(-5px); background-color: #B5952F; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ========================================= */
/* 8. Unified Responsive Media Queries       */
/* ========================================= */

.menu-toggle {
    display: none !important;
}

/* --- 8.0 โหมดลดขนาดและระยะห่างอัตโนมัติ ป้องกันเมนูล้นในจอโน้ตบุ๊กขนาดเล็ก (1201px - 1366px) --- */
@media (min-width: 1201px) and (max-width: 1366px) {
    .navbar { 
        padding: 0.6rem 1.5rem; 
    }
    .nav-menu-wrapper { 
        margin-left: 1.5rem; 
    }
    .nav-links { 
        gap: 0.7rem; /* บีบระยะห่างระหว่างเมนูหลักให้ชิดกันมากขึ้น */
    }
    .nav-links a.menu-item { 
        padding: 6px 12px; 
        font-size: 0.85rem; /* ย่อขนาดฟอนต์เมนูลงเล็กน้อยเพื่อให้พอดีพื้นที่ */
    }
    .nav-auth { 
        gap: 0.8rem; 
    }
    .register-btn, .btn-member { 
        padding: 8px 18px; 
        font-size: 0.85rem; /* กระชับขนาดปุ่มสมัครสมาชิก */
    }
}

/* --- 8.1 แท็บเล็ตและอุปกรณ์หน้าจอขนาดกลาง (ปรับความปลอดภัยขยับจาก 1024px เป็น 1200px) --- */
@media (max-width: 1200px) {
    .menu-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 42px;
        height: 42px;
        background: rgba(255, 255, 255, 0.12) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        border-radius: 50%;
        cursor: pointer;
        position: relative;
        z-index: 1200 !important; /* สูงกว่าแผงสไลด์กรมท่า */
        padding: 0;
        transition: all 0.3s ease;
    }

    /* บังคับเส้นสีขาวให้สว่าง คมชัด */
    .menu-toggle .bar {
        display: block !important;
        width: 20px;
        height: 2px;
        background-color: #FFFFFF !important;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    /* แอนิเมชันหมุนไขว้เป็นกากบาท (X) ตอนเมนูเปิดใช้งาน */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg) !important;
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0 !important;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg) !important;
    }

    /* ปรับแต่งเมนูย่อย (Benefits, Publication, etc.) ให้คมชัด ไม่โปร่งใสลอยทะลุฉากหลัง */
    .menu-dropdown-content {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.05) !important; /* พื้นหลังจางๆ ในแผงกรมท่า */
        box-shadow: none !important;
        border: none !important;
        padding: 0.5rem 0 0.5rem 15px !important; /* ดันเยื้องเข้าขวาให้รู้ว่าเป็นเมนูย่อย */
        border-left: 2px solid var(--blue) !important; /* เส้นสีฟ้าคั่นข้างหน้า */
        margin-top: 0.5rem;
        border-radius: 4px !important;
        
        /* เคลียร์ค่าจางล่องหนเดิมทิ้ง */
        display: none; /* ควบคุมการแสดงผลผ่าน JS */
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    /* ตัวอักษรเมนูย่อยตอนอยู่ในแท็บเล็ต/มือถือ */
    .menu-dropdown-content a {
        color: rgba(255, 255, 255, 0.9) !important; /* ตัวอักษรขาวสว่างชัดเจน */
        font-size: 0.95rem !important;
        padding: 10px 15px !important;
        border: none !important;
    }

    /* เมื่อเมาส์ Hover หรือกดเล่นในมือถือ */
    .menu-dropdown-content a:hover {
        background-color: rgba(74, 144, 226, 0.25) !important;
        color: #FFFFFF !important;
        padding-left: 20px !important;
    }

    /* เปลี่ยนระบบเนฟบาร์ให้กลายเป็น Drawer สไลด์ออกฝั่งขวามือ */
    .nav-menu-wrapper {
        position: fixed;
        top: 0; 
        right: -100%; 
        width: 300px; 
        height: 100vh;
        background: linear-gradient(135deg, #1C3A63 0%, #122540 100%); 
        box-shadow: -10px 0 35px rgba(0, 0, 0, 0.15);
        padding: 100px 30px 40px 30px;
        display: flex; 
        flex-direction: column; 
        justify-content: flex-start; 
        align-items: flex-start; 
        gap: 2.5rem;
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 1050;
    }
    .nav-menu-wrapper.active { 
        right: 0; 
    }

    .nav-links { 
        display: flex; 
        flex-direction: column; 
        align-items: flex-start; 
        width: 100%; 
        gap: 1.8rem; 
        margin: 0; 
    }
    .nav-links a.menu-item { 
        color: rgba(255, 255, 255, 0.85) !important; 
        font-size: 1.1rem; 
        width: 100%; 
        padding: 4px 0; 
    }
    .nav-links a.menu-item:hover { 
        background: transparent; 
        transform: none; 
        box-shadow: none; 
        color: var(--blue) !important; 
    }

    /* ชุดปุ่มจัดการหน้าล็อกอินฝั่งขวา */
    .nav-auth { 
        display: flex; 
        flex-direction: column; 
        width: 100%; 
        gap: 1rem; 
        margin-top: auto; 
        border-top: 1px solid rgba(255, 255, 255, 0.1); 
        padding-top: 1.5rem; 
    }
    .nav-auth .login-link { 
        color: #FFFFFF !important; 
        text-align: center; 
        padding: 10px; 
        width: 100%; 
    }
    .nav-auth .btn-member, .nav-auth .register-btn { 
        width: 100%; 
        text-align: center; 
        justify-content: center; 
    }

    /* ข้อกำหนดเมนูย่อยให้ขยายตัวแนวตั้งในจอมือถือ/แท็บเล็ต */
    .menu-dropdown-content {
        position: relative; 
        top: 0; 
        left: 0; 
        transform: none; 
        width: 100%; 
        background: transparent; 
        box-shadow: none; 
        border: none; 
        padding: 0 0 0 15px;
        display: none; 
        opacity: 1; 
        visibility: visible; 
        pointer-events: auto;
    }
    .menu-dropdown-wrapper:hover .menu-dropdown-content { 
        display: block; 
    }
    .menu-dropdown-content a { 
        color: rgba(255,255,255,0.7); 
        border: none; 
        padding: 8px 0; 
    }
    .menu-dropdown-content a:hover { 
        padding-left: 10px; 
        background: transparent; 
    }
}

/* --- 8.2 จอมือถือและแท็บเล็ตแนวตั้ง (ต่ำกว่า 992px) --- */
@media (max-width: 992px) {
    /* ส่วน Hero เพจหน้าแรกยุบคอลัมน์ */
    .hero-reveal {
        margin-top: 0 !important;      /* ล้างค่าติดลบเดิมที่ดันเนื้อหามุดใต้บาร์ */
        padding-top: 140px !important;  /* ดึงระยะปลอดภัยให้ไอคอนและตัวอักษรขยับลงมาด้านล่าง */
        height: auto !important;        /* เปลี่ยนจาก 100vh เป็น auto เพื่อให้ขยายความสูงตามปริมาณข้อความมือถือ */
        min-height: 100vh;
    }

    .hero-image-pale, 
    .hero-image-clear-1, 
    .hero-image-clear-2 {
        background-position: right center !important; /* ชิดขวาในแนวนอน และอยู่กึ่งกลางในแนวตั้ง */
    }
    
    .hero-content { 
        grid-template-columns: 1fr; 
        text-align: center; 
        gap: 30px; 
        padding: 0 24px; 
    }
    .hero-text-side { 
        align-items: center; 
    }
    .logo-animation-wrapper { width: 300px; height: 300px; }
    .hero-logo-display { max-width: 200px; }
    .ring-1 { width: 240px; height: 240px; }
    .ring-2 { width: 270px; height: 270px; }
    .connection-bg { width: 180px; height: 180px; }
    .hero-content h1 { font-size: 2.6rem; }
    .hero-content p { font-size: 1.25rem; max-width: 100%; padding: 0 10px; }

    /* หน้ารายละเอียดสิทธิประโยชน์แพทย์ */
    .page-header-section { margin-top: 110px; }
    .pub-main-title { font-size: 1.9rem; }
    .pub-table-card { padding: 1.5rem; border-radius: 16px; }
    .pub-search-box { max-width: 100%; }
    
    .benefits-grid-container { grid-template-columns: 1fr; padding: 0 20px; gap: 1.5rem; }
    .benefit-premium-card { padding: 2.5rem 1.5rem; }
}

/* --- 8.3 สมาร์ตโฟนขนาดมาตรฐาน (ต่ำกว่า 768px) --- */
@media (max-width: 768px) {
    .navbar { 
        width: 95%; 
        top: 10px; 
        border-radius: 50px; 
        padding: 0.6rem 1.5rem; 
    }

    .hero-content h1 { 
        font-size: 2.2rem !important; /* ย่อขนาดความหนาตัวอักษรลงมาให้กระชับพอดีจอมือถือ */
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
    }

    /* 🌟 เพิ่มเติมจุดนี้: ย่อขนาดข้อความคำโปรยภาษาไทย/อังกฤษด้านล่าง */
    .hero-content p {
        font-size: 1.1rem !important;
        line-height: 1.5 !important;
        margin-bottom: 2rem !important;
    }
    
    /* การ์ดแบบฟอร์มลงทะเบียนและล็อกอิน */
    .auth-container-wrapper { padding-top: 110px; }
    .auth-card { padding: 2rem 1.5rem; width: 92%; border-radius: 20px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-group { margin-bottom: 1.2rem; }
    .auth-card h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
    
    .hero-parallax { background-attachment: scroll; height: 60vh; }
    .section-title { font-size: 1.4rem; }
}

/* --- 8.4 สมาร์ตโฟนขนาดเล็กมาก (ต่ำกว่า 576px) --- */
@media (max-width: 576px) {
    /* โค้ดเดิมของคุณ (บีบขนาดแถว Navbar ป้องกันเบียดล้นขอบแคปซูล) */
    .navbar { padding: 8px 14px; }
    .nav-brand, .nav-logo { padding: 6px 16px; }
    .nav-brand-text, .logo-text { font-size: 1.2rem; }
    .nav-menu-wrapper { width: 100%; }

    /* 🌟 สิ่งที่ปรับปรุงเพิ่ม: สเกลลดขนาดกลุ่มโลโก้และฟอนต์ให้สมดุลกับจอขนาดแคบ */
    .hero-reveal {
        padding-top: 120px !important; /* ขยับขึ้นเล็กน้อยสัมพันธ์กับความสูงของ Navbar ที่หดลง */
    }

    /* หดขนาดย่อวงแหวนประวงนอก-วงใน เพื่อเซฟพื้นที่แนวตั้ง */
    .logo-animation-wrapper {
        width: 260px !important;
        height: 260px !important;
    }
    .hero-logo-display {
        max-width: 170px !important; /* ขนาดโลโก้ตรงกลาง */
    }
    .ring-1 { width: 210px !important; height: 210px !important; }
    .ring-2 { width: 240px !important; height: 240px !important; }
    .connection-bg { width: 150px !important; height: 150px !important; }

    /* ย่อขนาดตัวอักษรหัวข้อและคำโปรยให้พอดีกับระนาบสายตาบนจอมือถือเล็ก */
    .hero-content h1 {
        font-size: 1.9rem !important; /* ขนาดหัวข้อ Welcome to L.E.S.T. */
        line-height: 1.3 !important;
    }
    .hero-content p {
        font-size: 0.98rem !important; /* กระชับฟอนต์เนื้อหาภาษาไทย/อังกฤษให้อ่านง่าย */
        padding: 0 8px !important;
        margin-bottom: 1.8rem !important;
    }
    .btn-primary-hero {
        padding: 12px 28px !important;
        font-size: 0.95rem !important; /* ขนาดปุ่มเข้าร่วมสมาชิกให้กดง่ายพอดีนิ้วสัมผัส */
    }
}