﻿/* =========================================
   Color Theme: Teal-Green (#14B8A6)
========================================= */
:root {
    --primary-color: #14B8A6;
    --bg-color: #020504;
    --text-main: #ffffff;
    --text-muted: #A3B1AA;
    --card-bg: #0F1C18;
    --nav-bg: rgba(15, 28, 24, 0.95);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Kanit', sans-serif;
}

/* =========================================
   Global & Full Screen Background
========================================= */
body {
    background: linear-gradient(to bottom, rgba(68, 145, 119, 0.85), var(--bg-color)), 
                url('../../images/bg_megatreasure1.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-main);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

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

/* =========================================
   Navigation Bar
========================================= */
header {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 50px;
    border-bottom: 1px solid rgba(20, 184, 166, 0.1);
}

.header-left {
    display: flex;
    align-items: center; /* 👈 เพิ่มบรรทัดนี้เพื่อบังคับให้เนื้อหาตรงกลาง */
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--text-main);
    text-decoration: none;
}

.back-to-main {
    color: var(--text-main);
    font-size: 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.3s ease;
}

.back-to-main:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

header .logo img {
    height: 50px;
    max-width: 200px;
    object-fit: contain;
    transition: 0.3s ease;
    display: block;
}

header .logo img:hover {
    transform: scale(1.05);
}

.hero img {
    width: min(380px, 70%);
    max-width: 380px;
    height: auto;
    margin-bottom: 20px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: 0.3s;
    padding: 10px 0;
    display: inline-block;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    min-width: 250px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(20, 184, 166, 0.1);
}

.dropdown-content li { width: 100%; list-style: none; }
.dropdown-content a {
    padding: 12px 20px;
    display: block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    font-size: 15px;
}

.dropdown-content a:hover {
    background: var(--primary-color);
    color: #fff;
    padding-left: 25px;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.menu-toggle { display: none; }
.menu-icon { display: none; font-size: 28px; cursor: pointer; color: var(--text-main); }

/* =========================================
   Hero Section (หน้าแรก) 
========================================= */
.hero {
    height: 60vh;
    margin-top: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
}

.hero h1 {
    font-size: clamp(35px, 7vw, 70px);
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.hero h1 span { color: var(--primary-color); }
.hero p {
    font-size: clamp(16px, 4vw, 20px);
    color: var(--text-muted);
    max-width: 700px;
    font-weight: 300;
    line-height: 1.6;
}

/* =========================================
   Content Container & Grid (การ์ดสินค้าหน้าแรก)
========================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 20px;
}

.section-title {
    text-align: center;
    font-size: 30px;
    margin-bottom: 40px;
    position: relative;
    font-weight: 300;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--primary-color);
    margin: 15px auto 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* ปรับให้ยืดหยุ่นขึ้น */
    gap: 30px;
}

.card {
    background: rgba(15, 28, 24, 0.85); 
    backdrop-filter: blur(5px);
    border-radius: 20px;
    padding: 30px;
    transition: transform 0.4s, box-shadow 0.4s;
    text-align: center;
    border: 1px solid rgba(20, 184, 166, 0.1);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(20, 184, 166, 0.15);
    border-color: rgba(20, 184, 166, 0.5);
}

.card-img-wrapper {
    width: 100%;
    height: 220px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2); 
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.card h3 {
    margin-bottom: 15px;
    font-size: 20px;
    color: #fff;
}

.card p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 15px;
}

/* =========================================
   หน้า About Us
========================================= */
.about-hero {
    text-align: center;
    padding: 80px 20px 60px;
    background: linear-gradient(180deg, var(--card-bg) 0%, var(--bg-color) 100%);
    border-bottom: 1px solid rgba(20, 184, 166, 0.1);
    margin-top: 60px;
}

.about-hero h1 {
    font-size: clamp(32px, 5vw, 48px);
    color: #fff;
    margin-bottom: 15px;
}

.about-hero h1 span { color: var(--primary-color); }
.about-hero p {
    color: var(--text-muted);
    font-size: clamp(16px, 3vw, 18px); /* Responsive font */
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.about-section {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.about-image {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(20, 184, 166, 0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: 0.5s ease;
}

.about-image:hover img { transform: scale(1.05); }

.about-text h2 {
    font-size: clamp(24px, 4vw, 32px);
    color: var(--primary-color);
    margin-bottom: 20px;
}

.about-text p {
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 15px;
}

/* Core Values Section */
.values-header {
    text-align: center;
    margin: 60px 0 30px;
}

.values-header h2 {
    font-size: clamp(24px, 4vw, 32px);
    color: #fff;
}

.values-grid {
    max-width: 1200px;
    margin: 0 auto 80px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* ปรับให้ยืดหยุ่นขึ้น */
    gap: 30px;
}

.value-card {
    background: var(--card-bg);
    padding: 30px 20px;
    border-radius: 15px;
    border: 1px solid rgba(20, 184, 166, 0.1);
    text-align: center;
    transition: 0.3s;
}

.value-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 30px rgba(20, 184, 166, 0.15);
}

.value-icon { font-size: 45px; margin-bottom: 20px; display: inline-block; }
.value-card h3 { color: #fff; font-size: 20px; margin-bottom: 15px; }
.value-card p { color: var(--text-muted); font-size: 15px; line-height: 1.6; }

/* =========================================
   Footer
========================================= */
footer {
    background: var(--card-bg);
    padding: 50px 20px 20px;
    border-top: 1px solid rgba(20, 184, 166, 0.1);
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-col h4 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-main);
    font-weight: 700;
}

.footer-col h4 span { color: var(--primary-color); font-weight: bold; }
.footer-col p { color: var(--text-muted); line-height: 1.6; font-size: 15px; margin-bottom: 15px; font-weight: 500; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col ul a { color: var(--text-muted); text-decoration: none; transition: 0.3s; display: inline-block; font-weight: 600; }
.footer-col ul a:hover { color: var(--primary-color); transform: translateX(5px); }

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

/* =========================================
   RESPONSIVE DESIGN (Media Queries)
========================================= */

/* สำหรับหน้าจอ Tablet และ Mobile แนวนอน */
@media (max-width: 900px) {
    .about-section {
        grid-template-columns: 1fr;
        gap: 30px;
        margin: 40px auto;
    }
    .about-text { order: -1; text-align: center; } /* ให้ข้อความอยู่บนรูปภาพและจัดกึ่งกลาง */
    
    .product-container { grid-template-columns: 1fr; gap: 30px; }
}

/* สำหรับหน้าจอ Mobile */
@media (max-width: 768px) {
    /* Navbar */
    header { padding: 15px 20px; }
    .menu-icon { display: block; }
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--nav-bg);
        padding: 20px 0;
        border-bottom: 1px solid rgba(20, 184, 166, 0.2);
    }
    .menu-toggle:checked ~ .nav-menu { display: flex; }
    .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        background: rgba(255, 255, 255, 0.02);
        display: none;
        padding-left: 20px;
        width: 100%;
    }
    .dropdown:hover .dropdown-content { display: block; }
    
    header .logo img { height: 40px; } /* ลดขนาด Logo ลงในมือถือ */

    /* Spacing & Padding */
    .about-hero { padding: 60px 15px 40px; }
    .values-header { margin: 40px 0 20px; }
    .values-grid { margin-bottom: 40px; gap: 20px; }
    
    .grid { gap: 20px; }
    .container { padding: 30px 15px; }
    
    footer { padding: 40px 15px 20px; }
    .footer-container { gap: 20px; }
}

/* สำหรับหน้าจอมือถือขนาดเล็กมาก (เช่น iPhone SE) */
@media (max-width: 480px) {
    .grid { grid-template-columns: 1fr; }
    .values-grid { grid-template-columns: 1fr; }
    .card-img-wrapper { height: 200px; }
}
/* =========================================
   Footer Dropdown Button (Click to Open)
========================================= */
.footer-dropdown {
    position: relative;
    display: inline-block;
    margin-top: 15px;
}

.footer-dropbtn {
    background-color: rgba(20, 184, 166, 0.1); /* ใส่สีพื้นหลังจางๆ ให้ดูเป็นปุ่มชัดขึ้น */
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 12px 20px; /* เพิ่มขนาดปุ่มให้กดง่ายขึ้น */
    font-size: 15px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s ease;
}

.footer-dropbtn:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-2px); /* เอฟเฟกต์ยกปุ่มตอนชี้ */
}

/* กล่องเมนู Dropdown */
.footer-drop-content {
    display: none; /* ซ่อนไว้เป็นค่าเริ่มต้น */
    position: absolute;
    bottom: calc(100% + 10px); /* ดันเมนูขึ้น และเว้นระยะสวยๆ 10px */
    left: 0;
    background-color: var(--card-bg);
    min-width: 280px; /* เพิ่มความกว้างเมนูให้อ่านง่าย */
    box-shadow: 0px -8px 25px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: 10px;
    z-index: 10;
    overflow: hidden;
}

.footer-drop-content a {
    color: var(--text-main); /* เปลี่ยนสีตัวหนังสือให้สว่างขึ้น */
    padding: 14px 20px; /* เพิ่มพื้นที่คลิกให้ง่ายขึ้น (สำคัญมากบนมือถือ) */
    text-decoration: none;
    display: block;
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.3s ease;
}

.footer-drop-content a:last-child {
    border-bottom: none;
}

.footer-drop-content a:hover {
    background-color: rgba(20, 184, 166, 0.2); /* เปลี่ยนสีแถบตอนชี้ */
    color: var(--primary-color);
    padding-left: 25px; /* เลื่อนข้อความเล็กน้อย */
}

/* คลาสสำหรับสั่งให้แสดงผลเมนูด้วย Javascript */
.footer-drop-content.show-menu {
    display: block;
    animation: fadeUpDrop 0.3s ease;
}

/* แอนิเมชันตอนเมนูเด้งขึ้น */
@keyframes fadeUpDrop {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton Loading */
body.is-loading {
    overflow: hidden;
}

body.is-loading > *:not(.skeleton-loader) {
    visibility: hidden;
}

body.page-ready > *:not(.skeleton-loader) {
    visibility: visible;
}

.skeleton-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    background: #0f1417;
    transition: opacity 0.35s ease;
}

body.is-loading .skeleton-loader {
    opacity: 1;
    pointer-events: auto;
}

body.page-ready .skeleton-loader {
    opacity: 0;
}

.sk-topbar,
.sk-thumb,
.sk-line,
.sk-tags,
.sk-dot {
    position: relative;
    overflow: hidden;
    background: #1c2429;
    border-radius: 10px;
}

.sk-shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0) 100%);
    animation: skeleton-shimmer 1.25s infinite;
}

.sk-wrap,
.sk-canvas {
    width: min(1200px, 94vw);
    margin: 92px auto 0;
}

.sk-wrap {
    display: grid;
    gap: 20px;
}

.sk-topbar {
    height: 76px;
    border-radius: 0;
}

.sk-line {
    height: 14px;
    margin-bottom: 10px;
}

.sk-title {
    height: 42px;
    width: min(520px, 72%);
}

.sk-mid {
    width: 76%;
}

.sk-short {
    width: 58%;
}

.sk-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
}

.sk-panel {
    background: #151d21;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 16px;
}

.sk-product-head,
.sk-product-grid,
.sk-about-hero,
.sk-about-main,
.sk-about-values-head,
.sk-about-values-grid,
.sk-section,
.sk-hero,
.sk-grid,
.sk-split,
.sk-map {
    display: none;
}

/* Product skeleton: portfolio header + gallery cards */
body.skeleton-product .sk-product-head,
body.skeleton-product .sk-product-grid {
    display: grid;
}

body.skeleton-product .sk-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.sk-pcard {
    background: #151d21;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 12px;
}

.sk-pcard .sk-thumb {
    margin-bottom: 10px;
}

.sk-tags {
    height: 28px;
    width: 46%;
    border-radius: 999px;
    margin-top: 8px;
}

/* About skeleton: hero + split content + values cards */
body.skeleton-about .sk-about-hero,
body.skeleton-about .sk-about-main,
body.skeleton-about .sk-about-values-head,
body.skeleton-about .sk-about-values-grid {
    display: grid;
}

body.skeleton-about .sk-about-main {
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
}

.sk-portrait {
    aspect-ratio: 4 / 5;
}

body.skeleton-about .sk-about-values-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.sk-vcard {
    background: #151d21;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 14px;
}

.sk-dot {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    margin-bottom: 12px;
}

/* Keep existing fallback template (home/contact currently uses sk-section) */
body.skeleton-home .sk-hero,
body.skeleton-home .sk-grid,
body.skeleton-contact .sk-hero,
body.skeleton-contact .sk-split,
body.skeleton-contact .sk-map {
    display: grid;
}

body.skeleton-home .sk-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

body.skeleton-home .sk-card:nth-child(n+4) {
    display: none;
}

body.skeleton-contact .sk-split {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sk-mapbox {
    aspect-ratio: 16 / 5;
}

@keyframes skeleton-shimmer {
    to { transform: translateX(100%); }
}

@media (max-width: 1024px) {
    body.skeleton-product .sk-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sk-wrap,
    .sk-canvas {
        margin-top: 84px;
        gap: 14px;
    }

    .sk-title {
        height: 34px;
        width: 84%;
    }

    .sk-line {
        height: 12px;
    }

    body.skeleton-product .sk-product-grid,
    body.skeleton-about .sk-about-values-grid,
    body.skeleton-home .sk-grid {
        grid-template-columns: 1fr !important;
    }

    body.skeleton-about .sk-about-main,
    body.skeleton-contact .sk-split {
        grid-template-columns: 1fr !important;
    }

    .sk-pcard:nth-child(n+5) {
        display: none;
    }

    .sk-mapbox {
        aspect-ratio: 16 / 7;
    }
}
