/* === ธีมสีและสไตล์พื้นฐาน === */
:root {
    --primary-teal: #00947E;
    --dark-bg: #343a40;
    --primary-purple: #99A9F5;
    --light-bg: #f8f9fa;
    --text-grey: #bcbcbc;
    --text-dark: #212529;
    --text-light: #ffffff;
    --dark-gray-bg: #4b5462;
    --gray-bg: #e0e0e0;
    --slider-color-main: rgba(2, 153, 130, 0.75);
}

/* --- Preloader --- */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--light-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.75s ease, visibility 0.75s ease;
}

.preloader-logo {
    max-width: 150px;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100%{ opacity: 1; }
    50% { opacity: 0.5; }
}

body.loaded .preloader {
    opacity: 0;
    visibility: hidden;
}

img[loading="lazy"] {
    transition: opacity 0.3s ease-in-out;
}

img:not([src=""]):not([src="about:blank"]) {
    opacity: 1;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
}

.section-divider-line {
    border: none;
    height: 1px;
    margin: 0.5rem 0;
    background-color: var(--dark-bg);
}

/* --- Scrollbar --- */
::-webkit-scrollbar-track {
    background: var(--dark-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--gray-bg);
    border-radius: 4px;
    border: 1px solid transparent;
    border-color: var(--primary-teal)
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-purple);
}

/* --- sidebar mobile --- */
.desktop-nav {
    display: none;
}

.menu-button {
    display: block;
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 1001;
    background-color: var(--dark-bg);
    color: var(--text-light);
    border: none;
    font-size: 2rem;
    padding: 0 12px;
    border-radius: 5px;
    cursor: pointer;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background-color: var(--dark-bg);
    z-index: 1002;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    padding-top: 10px;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar ul li a {
    display: block;
    padding: 15px 20px;
    color: var(--text-light);
    text-decoration: none;
    margin: 0 5px;
    transition: background-color 0.2s;
}

.sidebar ul li a:hover {
    background-color: var(--primary-teal);
}

.sidebar ul li span {
    color: var(--primary-teal);
    padding: 15px 0;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 25px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 2.5rem;
    cursor: pointer;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sidebar-logo-container {
    padding: 20px;
    border-bottom: 1px solid var(--primary-teal);
}

.sidebar .sidebar-links-list .divider-above {
    border-top: 1px solid var(--primary-teal);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.sidebar-links {
    list-style: disc;
    border-bottom: 1px solid var(--primary-teal);
}

.sidebar .sidebar-links a.active{
    background-color: var(--primary-teal);
    border-radius: 20px;
    font-weight: 500;
}

.sidebar-logo {
    max-width: 150px;
}

.lang-switcher {
    display: flex;
    justify-content: center;
    font-weight: 500;
}

.lang-switcher .lang-btn.active {
    color: var(--primary-purple);
    font-weight: 500;
}

/* === Footer & Utilities === */
.main-footer {
    background-color: var(--dark-bg);
    color: var(--text-light);
    text-align: center;
    padding: 0.75rem;
}

.scroll-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background-color: var(--dark-bg);
    color: var(--text-light);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* === Reveal Effect on Scroll === */
.reveal-container {
    position: relative;
    overflow: hidden;
}

.reveal-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: var(--slider-color-main);
    z-index: 1;
    transition: transform 1.5s cubic-bezier(0.65, 0, 0.35, 1);
}

.reveal-container.visible::after {
    transform: translateX(101%);
}

.reveal-container > * {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    transition-delay: 0.4s;
}

.reveal-container.visible > * {
    opacity: 1;
    transform: scale(1);
}

/* === Tablet (1000px ขึ้นไป) === */
@media (min-width: 1000px) {
    .desktop-nav {
        display: flex;
        justify-content: center;
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 1000;
        padding: 0.5rem;
        background-color: transparent;
        transition: background-color 0.3s ease-in-out;
    }

    .desktop-nav.scrolled {
        background-color: var(--light-bg);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    }

    .nav-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        max-width: 950px;
        margin: 0 auto;
    }

    .nav-brand {
        font-size: 1.5rem;
        font-weight: bold;
        text-decoration: none;
        transition: color 0.3s ease-in-out;
        color: var(--text-grey);
    }

    .nav-brand .nav-logo {
        width: auto;
        max-height: 60px;
        vertical-align: middle;
        padding-left: 1.5rem;
    }

    .desktop-nav ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        padding-right: 1.5rem;
    }

    .desktop-nav ul li a {
        padding: 0 10px;
        text-decoration: none;
        transition: color 0.3s ease-in-out;
        color: var(--text-grey);
    }
    .desktop-nav ul li a:hover, 
    .desktop-nav ul li a.active {
        color: var(--primary-purple);
        font-weight: 500;
    }

    .desktop-nav ul li span {
        padding: 0;
        color: var(--text-grey);
    }

    .desktop-nav.scrolled .nav-brand, 
    .desktop-nav.scrolled ul li a,
    .desktop-nav.scrolled .lang-switcher .lang-btn {
        color: var(--text-dark);
    }
    .desktop-nav.scrolled ul li span {
        color: var(--text-dark);
    }
 
    .desktop-nav.scrolled ul li a.active {
        color: var(--primary-purple) !important;
        font-weight: 500;
    }

    .nav-item-dropdown {
        position: relative;
    }
    .dropdown-menu {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: var(--light-bg);
        list-style: none;
        padding: 0.5rem 0.25rem;
        margin: 0;
        min-width: 250px;
        box-shadow: 0 8px 16px rgba(0,0,0,0.2);
        border-radius: 5px;
        z-index: 1001;
    }
    .nav-item-dropdown:hover .dropdown-menu {
        display: block !important;
        color: var(--text-dark) !important;
    }
    .dropdown-menu li a {
        padding: 12px 20px !important;
        display: block;
        white-space: nowrap;
        text-decoration: none;
        color: var(--text-dark) !important;
    }
    .dropdown-menu li a:hover {
        background-color: var(--primary-purple);
        color: var(--text-dark) !important;
        border-radius: 5px;
    }

    .menu-button, .sidebar, .sidebar-overlay {
        display: none;
    }
}

@media (min-width: 1300px) {
    .nav-container {
        max-width: 1250px;
    }
}

@media (min-width: 1600px) {
    .nav-container {
        max-width: 1540px;
    }
}
