/* ==================== BASE & RESET ==================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { 
    font-family: var(--font-main, 'Prompt', sans-serif); 
    color: var(--text-main, #2d3748); 
    background-color: #e2e8f0; /* สีพื้นหลังรอบนอก เพื่อขับเน้นกรอบเว็บให้โดดเด่น */
    line-height: 1.7; 
    overflow-x: hidden; 
}

/* กรอบฟิกขนาดโครงสร้างเว็บหลัก (Main App Frame) */
.site-wrapper {
    max-width: 1240px;
    margin: 30px auto;
    background-color: var(--bg-page, #ffffff);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #cbd5e1;
}

.container-site { 
    max-width: 1160px; 
    margin: 0 auto; 
    padding: 0 24px; 
}

/* ==================== TOP BAR ==================== */
.top-bar { 
    background: #081a2d; 
    color: #94a3b8; 
    font-size: 13px; 
    padding: 10px 0; 
    border-bottom: 1px solid rgba(255,255,255,0.08); 
}
.top-bar-inner { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.top-bar a { color: #cbd5e1; text-decoration: none; }

/* ==================== HEADER & NAVBAR ==================== */
/* กรอบฟิกขนาดโครงสร้างเว็บหลัก (Main App Frame) */
.site-wrapper {
    max-width: 1240px;
    margin: 30px auto;
    background-color: var(--bg-page, #ffffff);
    border-radius: 18px;
    /* ปรับเป็น visible เพื่อให้ sticky navbar ทำงานได้ */
    overflow: visible; 
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #cbd5e1;
    position: relative;
}
/* ==================== HEADER & NAVBAR ==================== */
header#navbar { 
    background: #ffffff; 
    border-bottom: 1px solid #e2e8f0; 
    position: sticky; 
    top: 0; 
    z-index: 1000; /* ดันให้อยู่เหนือสไลเดอร์และเนื้อหาทั้งหมด */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    /* ขอบโค้งมนด้านบนให้เข้ากับกรอบเว็บ */
    border-top-left-radius: 17px;
    border-top-right-radius: 17px;
}
@media (max-width: 768px) {
    header#navbar {
        border-radius: 0; /* มือถือไม่มีขอบโค้ง ตรึงเต็มจอ */
    }
}
.header-inner { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 8px 0;
}

.logo { 
    display: flex; 
    align-items: center; 
    text-decoration: none; 
    font-size: 24px; 
    font-weight: 800; 
    color: var(--primary, #0f2b48); 
}
.logo span { color: var(--accent, #f39c12); }
.logo img { 
    width: auto; 
    object-fit: contain; 
    transition: height 0.2s ease;
}

.nav-list { display: flex; list-style: none; align-items: center; gap: 6px; }
.nav-item { position: relative; display: flex; align-items: center; }
.nav-link { 
    text-decoration: none; 
    color: #334155; 
    font-weight: 600; 
    font-size: 14.5px; 
    padding: 8px 16px; 
    border-radius: 6px; 
    display: flex; 
    align-items: center; 
    transition: all 0.2s ease; 
}
.nav-link:hover { color: var(--primary, #0f2b48); background: #f1f5f9; }
.nav-link .arrow { font-size: 9px; margin-left: 6px; }

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
    border-radius: 8px;
    list-style: none;
    padding: 8px 0;
    min-width: 220px;
    display: none;
    border-top: 3px solid var(--accent, #f39c12);
    border: 1px solid #e2e8f0;
    z-index: 1000;
}
.nav-item:hover .dropdown-menu { display: block; }
.dropdown-menu li a {
    display: block;
    padding: 10px 18px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.dropdown-menu li a:hover { background: #f8fafc; color: var(--primary, #0f2b48); padding-left: 22px; }

.mobile-toggle { 
    display: none; 
    background: none; 
    border: none; 
    font-size: 26px; 
    cursor: pointer; 
    color: var(--primary, #0f2b48); 
}
.mobile-drawer { 
    display: none; 
    position: fixed; 
    top: 75px; 
    left: 0; 
    width: 100%; 
    background: #fff; 
    box-shadow: 0 15px 30px rgba(0,0,0,0.15); 
    padding: 20px; 
    z-index: 998; 
}
.mobile-drawer.open { display: block; }
.mobile-drawer a { 
    display: block; 
    padding: 12px 0; 
    font-weight: 600; 
    text-decoration: none; 
    color: #1e293b; 
    border-bottom: 1px solid #f1f5f9; 
}

/* ==================== HERO MEDIA SLIDER ==================== */
.hero-slider-wrap {
    position: relative;
    width: 100%;
    height: 540px;
    overflow: hidden;
    background: #081a2d;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffffff;
    z-index: 1;
}

.slide-media-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.slide-content {
    position: relative;
    z-index: 3;
    max-width: 880px;
    width: 100%;
    padding: 0 24px;
}

.slide-content h1 {
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 16px;
    color: #ffffff !important;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.slide-content h1.title-sm { font-size: 2rem; }
.slide-content h1.title-md { font-size: 2.5rem; }
.slide-content h1.title-lg { font-size: 3rem; }
.slide-content h1.title-xl { font-size: 3.6rem; }

.slide-content p {
    color: #f8fafc;
    margin-bottom: 28px;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
    line-height: 1.6;
}
.slide-content p.sub-sm { font-size: 1rem; }
.slide-content p.sub-md { font-size: 1.2rem; }
.slide-content p.sub-lg { font-size: 1.4rem; }

/* Transitions */
.hero-slide.effect-fade { transition: opacity 0.8s ease-in-out, visibility 0.8s; }
.hero-slide.effect-fade.active { opacity: 1; visibility: visible; z-index: 2; }

.hero-slide.effect-slide { transform: translateX(100%); transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s, visibility 0.8s; }
.hero-slide.effect-slide.active { opacity: 1; visibility: visible; transform: translateX(0); z-index: 2; }

.hero-slide.effect-zoom { transition: opacity 0.8s ease-in-out, visibility 0.8s; }
.hero-slide.effect-zoom .slide-media-bg { transform: scale(1.18); transition: transform 6s cubic-bezier(0.16, 1, 0.3, 1); }
.hero-slide.effect-zoom.active { opacity: 1; visibility: visible; z-index: 2; }
.hero-slide.effect-zoom.active .slide-media-bg { transform: scale(1); }

.hero-slide.effect-slide-up { transform: translateY(100%); transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s, visibility 0.8s; }
.hero-slide.effect-slide-up.active { opacity: 1; visibility: visible; transform: translateY(0); z-index: 2; }

.slide-content.align-left { margin-right: auto; margin-left: 0; text-align: left; }
.slide-content.align-left .cta-group { justify-content: flex-start; }
.slide-content.align-center { margin: 0 auto; text-align: center; }
.slide-content.align-center .cta-group { justify-content: center; }
.slide-content.align-right { margin-left: auto; margin-right: 0; text-align: right; }
.slide-content.align-right .cta-group { justify-content: flex-end; }

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.65);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}
.slider-arrow:hover { background: var(--accent, #f39c12); border-color: var(--accent, #f39c12); transform: translateY(-50%) scale(1.08); }
.slider-prev { left: 20px; }
.slider-next { right: 20px; }

.slider-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 99;
}
.indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: all 0.3s ease;
}
.indicator-dot.active { width: 28px; border-radius: 10px; background: var(--accent, #f39c12); }

.cta-group { display: flex; gap: 16px; flex-wrap: wrap; }
.btn-cta-primary {
    background: var(--accent, #f39c12);
    color: #ffffff;
    padding: 13px 32px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(243, 156, 18, 0.35);
    transition: all 0.2s ease;
}
.btn-cta-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(243, 156, 18, 0.45); }

/* ==================== STATS COUNTER BAR ==================== */
.stats-bar {
    max-width: 960px;
    margin: -45px auto 0;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 26px 20px;
    position: relative;
    z-index: 10;
    text-align: center;
}
.stat-item { border-right: 1px solid #f1f5f9; }
.stat-item:last-child { border-right: none; }
.stat-item h3 { font-size: 2.4rem; color: var(--primary, #0f2b48); font-weight: 800; margin-bottom: 2px; }
.stat-item p { color: #64748b; font-size: 13px; font-weight: 600; text-transform: uppercase; }

/* ==================== SECTIONS COMMON ==================== */
.section { padding: 80px 0; }
.section-header { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.section-badge { color: var(--accent, #f39c12); font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; font-size: 12.5px; display: inline-block; margin-bottom: 8px; }
.section-title { font-size: 2.2rem; color: var(--primary, #0f2b48); font-weight: 800; margin-bottom: 8px; }
.section-desc { color: #64748b; font-size: 1.05rem; }
.bg-light { background: #f8fafc; }

/* About Us */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 45px; align-items: center; }
.about-img { width: 100%; height: 380px; object-fit: cover; border-radius: 14px; box-shadow: 0 15px 35px rgba(0,0,0,0.08); }
.about-text { font-size: 1.1rem; color: #475569; line-height: 1.85; }

/* Services Grid */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.service-card { 
    background: #ffffff; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04); 
    border: 1px solid #f1f5f9; 
    overflow: hidden; 
    transition: all 0.3s; 
}
.service-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08); }
.service-img { width: 100%; height: 175px; object-fit: cover; }
.service-body { padding: 24px; }
.service-icon-box { font-size: 32px; margin-bottom: 12px; }
.service-card h3 { font-size: 1.2rem; color: var(--primary, #0f2b48); margin-bottom: 10px; font-weight: 700; }
.service-card p { color: #64748b; font-size: 0.95rem; }

/* Filter Tabs */
.filter-tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 35px; flex-wrap: wrap; }
.filter-btn { background: #fff; border: 1px solid #cbd5e1; padding: 7px 18px; border-radius: 30px; font-size: 13.5px; font-weight: 600; color: #475569; cursor: pointer; transition: all 0.2s; }
.filter-btn.active, .filter-btn:hover { background: var(--primary, #0f2b48); color: #fff; border-color: var(--primary, #0f2b48); }

/* Projects & Activities Grid */
.projects-grid, .activities-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.project-card, .activity-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.04); border: 1px solid #f1f5f9; cursor: pointer; transition: all 0.3s; }
.project-card:hover, .activity-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(0,0,0,0.09); }
.project-img, .activity-img { width: 100%; height: 185px; object-fit: cover; }
.project-body, .activity-body { padding: 20px; }
.project-badge { background: rgba(15,43,72,0.08); color: var(--primary, #0f2b48); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 4px; display: inline-block; margin-bottom: 10px; }
.activity-meta { font-size: 12.5px; font-weight: 700; color: var(--accent, #f39c12); margin-bottom: 8px; }
.activity-title { font-size: 1.2rem; font-weight: 700; color: var(--primary, #0f2b48); margin-bottom: 8px; }
.activity-desc { font-size: 0.95rem; color: #64748b; }

/* Contact Section */
.contact-wrap { display: grid; grid-template-columns: 5fr 7fr; gap: 32px; max-width: 1020px; margin: 0 auto; }
.contact-info-card { background: linear-gradient(145deg, var(--primary, #0f2b48), #081a2d); color: #fff; padding: 38px; border-radius: 16px; box-shadow: 0 15px 35px rgba(15,43,72,0.22); }
.contact-info-card h3 { font-size: 1.8rem; font-weight: 800; margin-bottom: 15px; }
.contact-form-card { background: #fff; padding: 38px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid #f1f5f9; }
.contact-form .form-group { margin-bottom: 16px; }
.contact-form label { display: block; font-weight: 600; font-size: 13.5px; color: #334155; margin-bottom: 6px; }
.contact-form input, .contact-form textarea { width: 100%; padding: 11px 14px; border: 1px solid #cbd5e1; border-radius: 8px; font-family: inherit; font-size: 14px; }
.contact-form textarea { height: 110px; resize: vertical; }
.btn-submit-contact { background: var(--primary, #0f2b48); color: #fff; border: none; padding: 13px 25px; border-radius: 8px; font-weight: 700; font-size: 15px; cursor: pointer; width: 100%; transition: background 0.2s; }
.btn-submit-contact:hover { background: #081a2d; }

/* ==================== MODAL & CIRCLE ARROWS ==================== */
.modal { display: none; position: fixed; inset: 0; background: rgba(8, 26, 45, 0.85); z-index: 2000; justify-content: center; align-items: center; padding: 20px; }
.modal-content { background: #fff; max-width: 760px; width: 100%; border-radius: 16px; overflow: hidden; position: relative; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: none; background: #fff; cursor: pointer; font-size: 22px; font-weight: bold; z-index: 30; }

.modal-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    user-select: none;
    line-height: 1;
    padding: 0;
}
.modal-gallery-nav:hover {
    background: var(--accent, #f39c12);
    border-color: var(--accent, #f39c12);
    color: #ffffff;
    transform: translateY(-50%) scale(1.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}
#btnModalPrev { left: 16px; }
#btnModalNext { right: 16px; }

footer { background: #081a2d; color: #94a3b8; padding: 45px 0 25px; text-align: center; }

/* ==================== RESPONSIVE DESIGN (TABLET & MOBILE) ==================== */
/* แท็บเล็ต (หน้าจอ 768px - 1024px) */
@media (max-width: 1024px) {
    .site-wrapper {
        margin: 15px auto;
        max-width: 96%;
        border-radius: 14px;
    }
    .hero-slider-wrap { height: 480px; }
    .slide-content h1.title-lg, .slide-content h1.title-xl { font-size: 2.4rem; }
    .about-grid, .contact-wrap { gap: 28px; }
    .stats-bar { max-width: 90%; }
}

/* มือถือขนาดทั่วไปและหน้าจอขนาดเล็ก (ต่ำกว่า 768px) */
@media (max-width: 768px) {
    body {
        background-color: var(--bg-page, #ffffff); /* หน้าจอมือถือให้พื้นหลังกลืนกันเต็มจอ สวยงามไร้รอยต่อ */
    }
    .site-wrapper {
        margin: 0;
        max-width: 100%;
        border-radius: 0; /* เต็มจอไร้ขอบเมื่อดูในมือถือ */
        border: none;
        box-shadow: none;
    }
    .container-site { padding: 0 18px; }

    /* Top Bar */
    .top-bar-inner { flex-direction: column; gap: 4px; text-align: center; }

    /* Header & Mobile Toggle */
    .nav-list { display: none; }
    .mobile-toggle { display: block; }

    /* Hero Slider */
    .hero-slider-wrap { height: 420px; }
    .slider-arrow { display: none; } /* ซ่อนปุ่มเลื่อนด้านข้างในมือถือเพื่อไม่ให้บังข้อความ */
    .slide-content h1.title-sm, 
    .slide-content h1.title-md, 
    .slide-content h1.title-lg, 
    .slide-content h1.title-xl { 
        font-size: 1.85rem; 
    }
    .slide-content p.sub-sm,
    .slide-content p.sub-md,
    .slide-content p.sub-lg {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }
    .btn-cta-primary { padding: 11px 24px; font-size: 14px; }

    /* Stats Counter Bar */
    .stats-bar {
        grid-template-columns: 1fr;
        margin-top: -30px;
        gap: 15px;
        padding: 20px 15px;
    }
    .stat-item {
        border-right: none;
        border-bottom: 1px solid #f1f5f9;
        padding-bottom: 12px;
    }
    .stat-item:last-child { border-bottom: none; padding-bottom: 0; }
    .stat-item h3 { font-size: 2rem; }

    /* Sections */
    .section { padding: 55px 0; }
    .section-title { font-size: 1.8rem; }
    .about-grid, .contact-wrap { grid-template-columns: 1fr; }
    .about-img { height: 260px; }

    /* Grids */
    .services-grid, .projects-grid, .activities-grid {
        grid-template-columns: 1fr;
    }

    /* Contact Card */
    .contact-info-card, .contact-form-card { padding: 25px 20px; }
    .contact-info-card h3 { font-size: 1.5rem; }

    /* Modal ในมือถือ */
    #modalGalleryWrap { height: 280px !important; }
    .modal-gallery-nav { width: 38px; height: 38px; font-size: 16px; }
    #btnModalPrev { left: 8px; }
    #btnModalNext { right: 8px; }
    .modal-body { padding: 20px; }
}