/* --- CSS กลางสำหรับทุกหน้า --- */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;700&display=swap');

body {
    font-family: 'Sarabun', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    padding-bottom: 80px; /* เพิ่มพื้นที่สำหรับ footer (Desktop) */
}

/* --- Navigation Bar (ใช้ร่วมกันทุกหน้า) --- */
header {
    background-color: #fff;
    color: #333;
    padding: 15px 10%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #003366;
}

nav a {
    color: #333;
    margin: 0 15px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    transition: color 0.3s ease;
}

nav a:hover {
    color: #0056b3;
}

.container {
    width: 80%;
    margin: 40px auto;
    overflow: hidden;
}

/* --- Footer (ใช้ร่วมกันทุกหน้า) --- */
footer {
    background: #222;
    color: #fff;
    text-align: center;
    padding: 1.5rem 0;
    position: fixed; /* Fixed บน Desktop */
    bottom: 0;
    width: 100%;
    z-index: 998; /* ต่ำกว่าปุ่มแชท */
}

/* --- CSS สำหรับหน้า Contact --- */
.contact-container {
    background-color: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 700px;
    margin: 40px auto;
    text-align: center;
}

.contact-container h1 {
    color: #003366;
    margin-top: 0;
}

.contact-container p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
    text-align: left; /* จัดข้อความชิดซ้ายให้อ่านง่าย */
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.contact-container p strong {
    color: #333;
}

.back-button {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 25px;
    background-color: #0056b3;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.back-button:hover {
    background-color: #003366;
}
/* --- CSS สำหรับหน้าแผนผัง --- */
.map-container {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.map-container h1 {
    color: #003366;
    margin-top: 0;
    margin-bottom: 40px;
    font-size: 2rem;
}

.map-item {
    margin-bottom: 50px; /* ระยะห่างระหว่างแต่ละแผนผัง */
}

.map-item h2 {
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.map-item img {
    max-width: 100%; /* ทำให้รูปภาพย่อ-ขยายตามขนาดหน้าจอ */
    height: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
}
/* --- CSS สำหรับปุ่มตัวเลือก (หน้าแรก) --- */
.button-container {
    text-align: center; /* จัดปุ่มให้อยู่ตรงกลาง */
    margin-bottom: 30px; /* เพิ่มระยะห่างจากหัวข้อ "แบรนด์ชั้นนำ" */
}

.button-link {
    background-color: #0056b3; /* สีพื้นหลังปุ่ม */
    color: white; /* สีตัวอักษร */
    padding: 12px 25px; /* ขนาดของปุ่ม */
    text-decoration: none; /* เอาขีดเส้นใต้ออก */
    border-radius: 5px; /* ทำให้ขอบมน */
    font-weight: bold;
    margin: 0 10px; /* ระยะห่างระหว่างปุ่ม */
    transition: background-color 0.3s ease;
}

.button-link:hover {
    background-color: #003366; /* สีปุ่มเมื่อเมาส์ชี้ */
}
/* --- CSS สำหรับหน้าเกี่ยวกับเรา (ทั่วไป) --- */
.about-section {
    background-color: #fff;
    padding: 30px 40px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.about-section h1, .about-section h2 {
    text-align: center;
    color: #003366;
    margin-top: 0;
    margin-bottom: 25px;
}

.about-intro {
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
    max-width: 800px;
    margin: 0 auto 30px auto;
}

/* --- Team Grid (Desktop) --- */
.team-grid {
    display: flex;
    justify-content: center;
    gap: 40px; /* ระยะห่างบน Desktop */
    flex-wrap: wrap;
}

.team-member {
    text-align: center;
}

.team-member img {
    width: 180px; /* ขนาดรูปบน Desktop */
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #0056b3;
    margin-bottom: 15px;
}

.team-member h3 {
    margin: 0;
    color: #333;
}

.vision-mission {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.vision, .mission {
    flex: 1;
}

.vision p {
    font-size: 2rem;
    font-style: italic;
    text-align: center;
    background-color: #f4f7fc;
    padding: 20px;
    border-radius: 8px;
}

.mission ul {
    list-style: none;
    padding: 0;
}

.mission li {
    padding: 10px 0 10px 30px;
    position: relative;
    font-size: 1.1rem;
    border-bottom: 1px solid #f0f0f0;
}

.mission li::before {
    content: '✓';
    color: #0056b3;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 10px;
}

/* --- CSS สำหรับ Gallery Grid (หน้า About) --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 คอลัมน์ */
    gap: 20px;
}

.gallery-grid-final {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 คอลัมน์ */
    gap: 20px;
}

.gallery-grid img, .gallery-grid-final img {
    width: 100%;
    border-radius: 8px;
    height: 300px; /* กำหนดความสูงให้เท่ากัน */
    object-fit: cover; /* ทำให้รูปเต็มกรอบโดยไม่เสียสัดส่วน */
    transition: transform 0.1s ease;
}

.gallery-grid img:hover, .gallery-grid-final img:hover {
    transform: scale(1.09); /* ลดการขยายลงเล็กน้อย */
}

/* --- CSS สำหรับหน้า KRV (ประวัติและแผนที่) --- */

.branch-list {
    list-style-type: none; /* เอา bullet point ออก */
    padding-left: 0;
}

.branch-list li {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
    padding-bottom: 10px;
}

/* ดีไซน์ส่วนเลือกแผนที่ (แบบ 2 คอลัมน์) */
.map-selector-container {
    display: flex;
    flex-wrap: wrap; /* ทำให้ขึ้นบรรทัดใหม่บนจอมือถือ */
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden; /* ทำให้ขอบมนสวยงาม */
    margin-top: 30px;
}

.map-controls {
    flex: 40%; /* ให้ส่วนควบคุมกว้าง 40% */
    padding: 20px;
    background-color: #fcfcfc;
    border-right: 1px solid #eee;
}

.map-controls h3 {
    margin-top: 0;
    color: #003366;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.location-item {
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.location-item:last-child {
    border-bottom: none;
}

.location-item h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.location-item p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.location-item:hover {
    background-color: #f4f7fc;
}

.location-item.active {
    background-color: #0056b3;
    color: #fff;
}

.location-item.active h4 {
    color: #fff;
}

.location-item.active p {
    color: #e0e0e0;
}

.map-display {
    flex: 60%; /* ให้แผนที่กว้าง 60% */
    min-height: 450px;
}

.map-display iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- CSS สำหรับรูปภาพในหน้า ADP (adp.html) --- */

.about-section .full-width-image {
    width: 100%;
    height: auto;
    border-radius: 8px; /* ทำให้ขอบมนเหมือนภาพอื่นๆ */
    margin-bottom: 20px; /* ระยะห่างจากเนื้อหาด้านล่าง */
    object-fit: cover; /* ทำให้รูปภาพเต็มพื้นที่โดยไม่เสียสัดส่วน */
}

.about-section .header-image {
    max-height: 350px; /* กำหนดความสูงสูงสุด */
    object-position: center top; /* เน้นส่วนบนของภาพ */
}

.three-branch-images img { /* ใช้กับ Grid ใน ADP */
    height: 250px; /* กำหนดความสูงคงที่ */
    object-fit: cover; /* ทำให้รูปเต็มพื้นที่โดยไม่เสียสัดส่วน */
}

.sponsor-section {
    text-align: center; /* จัดโลโก้และหัวข้อให้อยู่ตรงกลาง */
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee; /* เพิ่มเส้นคั่นด้านบน */
}

.sponsor-section h2 {
    margin-bottom: 25px;
}

.sponsor-section .sponsor-logo {
    max-width: 600px; /* กำหนดขนาดสูงสุดของโลโก้ */
    display: block; /* ทำให้จัดกลางได้ */
    margin-left: auto;
    margin-right: auto;
    height: auto;
}

/* --- CSS สำหรับหน้า KRV (บริษัท เกียรติเรืองเวท จำกัด) --- */

.business-details-list {
    list-style: none; /* เอารายการแบบจุดออก */
    padding: 0;
    margin-top: 25px;
    background-color: #fcfcfc;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden; /* สำหรับคุมขอบมน */
}

.business-details-list li {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    padding: 12px 20px;
}

.business-details-list li:last-child {
    border-bottom: none;
}

.business-details-list li strong {
    color: #003366; /* สีหัวข้อหลัก */
    min-width: 160px; /* จัดให้หัวข้อกว้างเท่าๆ กัน */
    display: inline-block; /* ทำให้หัวข้ออยู่บรรทัดเดียวกับข้อความ (Desktop) */
    margin-right: 15px;
    font-weight: 700; /* กำหนดความหนาให้ชัดเจน */
}

.single-map-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden; /* ทำให้ขอบ iframe มนตาม container */
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-top: 20px;
    border: 1px solid #ddd;
}

.single-map-container iframe {
    display: block; /* แก้ปัญหาช่องว่างเล็กน้อยใต้ iframe */
}

/* --- CSS สำหรับโลโก้ Partner (หน้าแรก) --- */
.partners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    align-items: center;
    margin-top: 30px;
}

.partner-logo {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background-color: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    box-sizing: border-box;
    transition: transform 0.3s ease;
}

.partner-logo:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* --- CSS สำหรับปุ่มแชทลอย และหน้าฟอร์มอีเมล --- */

.floating-chat-button {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #0056b3; /* ปรับสีให้เข้ากับปุ่มอื่นๆ */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
    text-decoration: none;
    z-index: 999;
}

.floating-chat-button:hover {
    transform: scale(1.1);
    background-color: #003366; /* ปรับสีตอน hover ให้เข้ากัน */
}

.email-form-container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    margin: 40px auto;
}

.email-form-container .form-header {
    text-align: center;
    margin-bottom: 30px;
}

.email-form-container .form-header h1 {
    color: #003366; /* สีเดียวกับ h1 อื่นๆ */
    margin-bottom: 10px;
}

.email-form-container .form-header p {
    color: #666;
    font-size: 1rem;
}

.email-form-container .form-group {
    margin-bottom: 20px;
}

.email-form-container .info-group {
    background-color: #f4f7fc;
    border-left: 4px solid #0056b3;
    padding: 15px;
    border-radius: 8px;
}

.email-form-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.email-form-container .recipient-email {
    font-size: 1.1rem;
    font-weight: bold;
    color: #0056b3;
    margin: 0;
}

.email-form-container input[type="email"],
.email-form-container input[type="text"],
.email-form-container textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Sarabun', sans-serif; /* ใช้ฟอนต์ Sarabun เหมือนส่วนอื่นๆ */
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.email-form-container input[type="email"]:focus,
.email-form-container input[type="text"]:focus,
.email-form-container textarea:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
}

.email-form-container textarea {
    resize: vertical;
}

.email-form-container button[type="submit"] {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background-color: #0056b3;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    font-family: 'Sarabun', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s;
}

.email-form-container button[type="submit"]:hover {
    background-color: #003366;
}

.email-form-container .footer-note {
    text-align: center;
    margin-top: 25px;
    color: #777;
    font-size: 0.9rem;
}

/* ==============================================
   CSS สำหรับ Swiper.js (Sliders) - เจาะจงด้วย ID
============================================== */

/* กำหนดเป้าหมายเฉพาะ Swiper container ที่มี id="gallery4", id="apdGallery", id="krvGallery" */
#gallery4.swiper-container,
#apdGallery.swiper-container,
#krvGallery.swiper-container {
    width: 100%;
    padding-top: 30px; 
    padding-bottom: 50px;
    margin-top: 20px; 
    overflow: hidden; 
}

/* กำหนดเป้าหมายเฉพาะ Slide ภายใน */
#gallery4 .swiper-slide,
#apdGallery .swiper-slide,
#krvGallery .swiper-slide {
    background-position: center;
    background-size: cover;
    width: 300px; 
    height: 300px; 
    display: flex;
    align-items: center;
    justify-content: center;
}

#gallery4 .swiper-slide img,
#apdGallery .swiper-slide img,
#krvGallery .swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    border-radius: 8px; 
}

/* กำหนดเป้าหมายเฉพาะปุ่มลูกศรภายใน */
#gallery4 .swiper-button-next,
#gallery4 .swiper-button-prev,
#apdGallery .swiper-button-next,
#apdGallery .swiper-button-prev,
#krvGallery .swiper-button-next,
#krvGallery .swiper-button-prev {
    color: #003366; 
    width: 40px; 
    height: 40px;
    margin-top: -20px; 
}

/* CSS สำหรับ Hover Effect ของ Sponsor Logo (Moccona) */
#moccona-sponsor-logo {
    transition: transform 0.3s ease; /* เพิ่ม transition ให้ smooth */
}

#moccona-sponsor-logo:hover {
    transform: scale(1.1); /* ขยาย 110% (ปรับเลขได้) */
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); /* เพิ่มเงาตอน hover */
}


/* ==============================================
   CSS หลักสำหรับแก้จอบีบ (Responsive)
   *** นี่คือโค้ดสำหรับมือถือทั้งหมด รวมไว้ที่เดียว ***
============================================== */

@media (max-width: 768px) {

    /* --- 1. การตั้งค่า Body และ Container --- */
    body {
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 0; 
        box-sizing: border-box; 
    }

    .container {
        width: 100%; 
        margin: 20px auto; 
        padding: 0 5px; 
        box-sizing: border-box;
    }

    /* --- 2. Header และ Nav --- */
    header {
        flex-direction: column; 
        align-items: center;
        padding: 15px;
    }

    .logo {
        font-size: 1.3rem; 
        margin-bottom: 10px;
    }

    nav {
        width: 100%;
        display: flex;
        flex-wrap: wrap; /* ทำให้เมนูขึ้นบรรทัดใหม่ได้ */
        justify-content: center;
        gap: 5px;
    }

    nav a {
        font-size: 0.85rem; 
        margin: 0 5px;
        padding: 5px 8px; 
    }

    /* --- 3. Footer --- */
    footer {
        position: static; 
        padding: 1rem 10px;
        font-size: 0.9rem;
    }
    
    /* --- 4. ปุ่ม 2 บริษัท (หน้าแรก) --- */
    .button-link {
        display: inline-block; 
        width: auto;           
        padding: 10px 14px; 
        font-size: 0.85rem; 
        margin: 5px 5px;    
    }

    /* --- 5. หน้า Contact --- */
    .contact-container {
        padding: 20px;
        margin: 20px auto;
    }
    .contact-container p {
        font-size: 1rem;
    }

    /* --- 6. หน้า Map (แผนผัง) --- */
    .map-container {
        padding: 20px;
    }
    .map-container h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    .map-item h2 {
        font-size: 1.2rem;
    }

    /* --- 7. หน้า About (เกี่ยวกับเรา) --- */
    .about-section {
        padding: 20px;
    }
    .about-section h1, .about-section h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    .about-intro {
        font-size: 1rem;
    }

    /* แก้ไข Team Grid ให้เรียงแนวนอน (ฉบับแก้ไขล่าสุด) */
    .team-grid {
        display: flex; /* ใช้ flex */
        justify-content: center; /* จัดกลาง */
        gap: 15px; /* ลดระยะห่าง */
        flex-wrap: wrap; 
    }

    .team-member {
        flex: 0 1 calc(50% - 15px); /* กว้างเกือบครึ่งจอ เผื่อ gap */
        max-width: 150px; /* จำกัดความกว้าง */
        text-align: center;
    }

    .team-member img {
        width: 110px; /* ขนาดรูปบนมือถือ */
        height: 110px;
        margin-bottom: 8px;
        border-width: 3px;
    }

    .team-member h3 {
        font-size: 0.7rem; /* ลดขนาดชื่อ */
        white-space: nowrap; 
        overflow: hidden; 
        text-overflow: ellipsis; 
        max-width: 140px; 
        margin-left: auto; 
        margin-right: auto; 
        margin-top: 0; 
        font-weight: normal; /* ทำให้ชื่อไม่หนา */
    }

    .vision-mission {
        flex-direction: column;
        gap: 20px;
    }
    .vision p {
        font-size: 1.2rem;
        padding: 15px;
    }
    .mission li {
        font-size: 1rem;
        padding: 8px 0 8px 25px;
    }
    .mission li::before {
        top: 8px;
    }

    .gallery-grid, .gallery-grid-final {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .gallery-grid img, .gallery-grid-final img {
        height: 200px;
    }
    
    /* --- 8. หน้า ADP (อาภานนท์) --- */
    .three-branch-images {
        grid-template-columns: 1fr;
    }
    .three-branch-images img {
        height: 150px; 
    }

    .sponsor-section .sponsor-logo {
        max-width: 90%;
    }

    .map-selector-container {
        flex-direction: column;
    }
    .map-controls, .map-display {
        flex: 100%;
        min-height: 300px;
    }
    .map-controls {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    .location-item {
        padding: 10px;
    }
    .location-item h4 {
        font-size: 0.95rem;
    }
    .location-item p {
        font-size: 0.8rem;
    }

    /* --- 9. หน้า KRV (เกียรติเรืองเวท) และ ADP --- */
    /* (แก้ไขให้ใช้พื้นที่เต็มที่ และแก้ฟอนต์ไม่เท่ากัน) */
    .business-details-list li {
        font-size: 0.9rem; 
        padding: 10px 10px; /* ลด padding ซ้ายขวา */
        line-height: 1.6; 
        white-space: normal !important; /* ขึ้นบรรทัดใหม่ */
        overflow: visible !important; 
        text-overflow: clip !important; 
        text-align: left !important; /* บังคับชิดซ้าย */
    }
    
    .business-details-list li strong {
        display: block;
        margin-bottom: 3px;
        font-weight: 700 !important; /* บังคับตัวหนา */
        color: #003366; 
        min-width: unset; /* ยกเลิก min-width */
        margin-right: 0; /* ยกเลิก margin */
        text-align: left !important; /* บังคับชิดซ้าย */
    }

    .single-map-container iframe {
        height: 300px;
    }

    /* --- 10. โลโก้ Partner (หน้าแรก) --- */
    .partners-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    .partner-logo {
        height: 80px;
        padding: 10px;
    }

    /* --- 11. หน้า Email Form (log emaill) --- */
    .email-form-container {
        padding: 25px;
        margin: 20px auto;
    }
    .email-form-container .form-header h1 {
        font-size: 1.5rem;
    }
    .email-form-container .form-header p,
    .email-form-container label,
    .email-form-container .recipient-email,
    .email-form-container input,
    .email-form-container textarea,
    .email-form-container button {
        font-size: 1rem;
    }
    .email-form-container button[type="submit"] {
        padding: 12px;
    }
    .email-form-container .footer-note {
        font-size: 0.8rem;
    }
    
    /* --- 12. Swiper Slider (Gallery 4, apdGallery, krvGallery) --- */
    #gallery4 .swiper-slide,
    #apdGallery .swiper-slide,
    #krvGallery .swiper-slide {
        width: 250px; 
        height: 180px; 
    }
    #gallery4 .swiper-button-next,
    #gallery4 .swiper-button-prev,
    #apdGallery .swiper-button-next,
    #apdGallery .swiper-button-prev,
    #krvGallery .swiper-button-next,
    #krvGallery .swiper-button-prev {
        width: 30px; 
        height: 30px;
        margin-top: -15px;
    }
}