/*
Theme Name: Green Library
Theme URI: https://example.com/green-library
Author: Library Team
Description: Green eco-friendly theme (Final Consolidated Version 2.0).
Version: 1.0.6
*/

/* ==========================================
   1. CSS Variables & Reset
   ========================================== */
:root {
    --primary-green: #4a7c59;
    --light-green: #d4e8d4;
    --pale-green: #e8f5e8;
    --dark-green: #2d5a3d;
    --accent-orange: #f39c12;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

/* Important: Reset body margin to 0 for Full Bleed Layout */
html, body { 
    width: 100%; 
    margin: 0 !important; 
    padding: 0 !important; 
    overflow-x: hidden; 
}

body { font-family: 'Sarabun', 'Noto Sans Thai', sans-serif; line-height: 1.6; color: var(--text-dark); background-color: var(--white); }
img { max-width: 100%; height: auto; }
a { color: var(--primary-green); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--dark-green); }

/* ==========================================
   2. Header & Navigation
   ========================================== */
.site-header { background-color: var(--white); box-shadow: 0 2px 10px var(--shadow); position: sticky; top: 0; z-index: 100; }
.site-header-container { max-width: 1400px; margin: 0 auto; padding: 0.5rem 2rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.site-logo { display: flex; align-items: center; gap: 1rem; }
.site-logo img { width: auto; height: auto; max-height: 120px; object-fit: contain; }
.site-logo a { color: var(--primary-green); text-decoration: none; font-size: 1.5rem; font-weight: 700; }
.site-title { font-size: 1.5rem; font-weight: 700; color: var(--primary-green); margin: 0; }

.main-navigation { display: flex; align-items: center; flex: 1; justify-content: flex-end; }
.main-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2rem; flex-wrap: nowrap; }
.main-navigation a { color: var(--text-dark); font-weight: 500; padding: 0.5rem 0; position: relative; }
.main-navigation a:hover, .main-navigation a.active { color: var(--primary-green); }
.main-navigation a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background-color: var(--primary-green); transition: width 0.3s ease; }
.main-navigation a:hover::after { width: 100%; }

/* --- Desktop Sub-Menu --- */
.main-navigation li { position: relative; }
.main-navigation .sub-menu { position: absolute; top: 100%; left: 0; background-color: var(--white); min-width: 220px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border-radius: 0 0 8px 8px; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease; z-index: 999; padding: 0.5rem 0; list-style: none; margin: 0; border-top: 2px solid var(--primary-green); }
.main-navigation li:hover > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.main-navigation .sub-menu li { display: block; margin: 0; }
.main-navigation .sub-menu a { display: block; padding: 0.8rem 1.5rem; color: var(--text-dark); font-size: 0.95rem; white-space: nowrap; border-bottom: 1px solid #f0f0f0; }
.main-navigation .sub-menu a:hover { background-color: var(--pale-green); color: var(--primary-green); }
.main-navigation .sub-menu li:last-child a { border-bottom: none; }
.main-navigation .sub-menu a::after { display: none; }

/* Level 3 Sub-menu (Show on Right) */
.main-navigation .sub-menu .sub-menu { top: 0; left: 100%; margin-top: -2px; transform: translateX(10px); }
.main-navigation .sub-menu li:hover > .sub-menu { opacity: 1; visibility: visible; transform: translateX(0); left: 100%; }
.main-navigation .sub-menu .menu-item-has-children > a::after { content: '›'; display: inline-block; float: right; margin-left: 1rem; font-size: 1.2rem; line-height: 1; transform: rotate(0); }

/* ==========================================
   3. Universal Title Styles (Center & Gradient Line)
   ========================================== */
.section-title, 
.about-green-title, 
.column-title,
.green-office-statistics .section-title,
.latest-posts-section .section-title {
    position: relative;
    padding-bottom: 15px;
    margin-bottom: 2rem !important;
    text-align: center !important;
    display: block;
    width: 100%;
    color: var(--primary-green);
    font-weight: 700;
}

/* Gradient Line Underline */
.section-title::after, 
.about-green-title::after, 
.column-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    background: linear-gradient(90deg, #d4e8d4, #4a7c59, #d4e8d4);
    border-radius: 2px;
}

/* ==========================================
   4. Hero Section (Slider)
   ========================================== */
.hero-section { position: relative; width: 100%; max-width: 100vw; overflow: hidden; background-color: var(--pale-green); }
.carousel-slides { position: relative; width: 100%; height: 600px; overflow: hidden; }

/* Slide Animation */
.carousel-slide { position: absolute !important; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; visibility: hidden; z-index: 1; transition: opacity 1s ease-in-out, visibility 1s ease-in-out; }
.carousel-slide.active { opacity: 1 !important; visibility: visible !important; z-index: 2; }
.carousel-slide-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-slide-link { display: block; width: 100%; height: 100%; }

/* Controls */
.carousel-control { position: absolute; top: 50%; transform: translateY(-50%); background-color: rgba(0, 0, 0, 0.3); color: #fff; border: 2px solid rgba(255,255,255,0.5); width: 50px; height: 50px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; transition: all 0.3s ease; }
.carousel-control:hover { background-color: var(--primary-green); border-color: var(--primary-green); }
.carousel-control.prev { left: 20px; }
.carousel-control.next { right: 20px; }
.carousel-control svg { width: 24px; height: 24px; stroke: #fff; }

/* Indicators */
.carousel-indicators { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 10; }
.carousel-indicator { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; background-color: transparent; cursor: pointer; padding: 0; transition: all 0.3s ease; }
.carousel-indicator.active { background-color: #fff; transform: scale(1.2); }

/* ==========================================
   5. Statistics/Graph Section (2 Units Spacing)
   ========================================== */
.green-office-statistics { 
    padding-top: 2rem !important; 
    padding-bottom: 2rem !important; 
    background: linear-gradient(135deg, var(--pale-green) 0%, #f0f9f0 100%); 
    margin-top: 0 !important; 
}
.green-office-statistics .section-container { max-width: 1850px !important; width: 98%; margin: 0 auto; }
.statistics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; margin-bottom: 2rem; justify-content: center !important; }

/* Cards */
.stat-graph-card { display: flex; flex-direction: column; background: var(--white); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; text-decoration: none; height: 100%; }
.stat-graph-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); }
.stat-graph-header { background-color: var(--primary-green); padding: 1.2rem; min-height: 70px; display: flex; align-items: center; justify-content: center; text-align: center; }
.stat-graph-title-top { color: var(--white); font-size: 1.2rem; font-weight: 600; margin: 0; line-height: 1.4; }
.stat-graph-image { width: 100%; aspect-ratio: 16/10; overflow: hidden; background: #f0f0f0; }
.stat-graph-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.stat-graph-card:hover .stat-graph-image img { transform: scale(1.05); }
.stat-graph-footer { padding: 1rem; background-color: var(--white); border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; margin-top: auto; }
.stat-graph-view { color: var(--primary-green); font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }

/* ==========================================
   6. News Section (2 Units Spacing)
   ========================================== */
.latest-posts-section {
    padding-top: 2rem !important; 
    padding-bottom: 2rem !important; 
}
.latest-posts-section .section-container { max-width: 1900px !important; width: 98%; margin: 0 auto; padding: 0 1rem; }
.posts-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.5rem; margin-bottom: 2rem; justify-content: center !important; }

/* Cards */
.post-card { background-color: var(--white); border-radius: 10px; overflow: hidden; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08); transition: transform 0.3s ease; display: flex; flex-direction: column; height: 100%; }
.post-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12); }
.post-card-image { width: 100%; aspect-ratio: 16/10; overflow: hidden; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.post-card:hover .post-card-image img { transform: scale(1.05); }
.post-card-content { padding: 1.2rem; display: flex; flex-direction: column; flex-grow: 1; }
.post-card-title { font-size: 1.1rem; line-height: 1.4; margin-bottom: 0.5rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ==========================================
   7. Green Office & Green Library Section (4 Units Spacing)
   ========================================== */
.about-green-section {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
    background-color: var(--pale-green);
}
.about-green-container { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2rem; }
.about-green-image img { width: 300px; height: 300px; border-radius: 50%; object-fit: cover; box-shadow: 0 10px 30px var(--shadow); margin: 0 auto; }
.about-green-content { flex: 1; text-align: center; }
.about-green-title { font-size: 2.5rem; color: var(--primary-green); font-weight: 700; line-height: 1.3; }
.about-green-description { font-size: 1.1rem; color: var(--text-dark); line-height: 1.8; }

/* ==========================================
   8. Map - Info - Social (FULL WIDTH VERSION)
   ========================================== */
.map-info-section {
    padding: 1rem 0;
    background-color: #f5f8f5;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    width: 100%; 
    overflow-x: hidden;
}

.map-info-section .section-container {
    max-width: 100% !important; 
    width: 100% !important; 
    margin: 0 !important; 
    padding-left: 15px !important; 
    padding-right: 15px !important; 
}

.map-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 1.5rem; 
    align-items: start;
    width: 100%; 
}

.map-column, .info-column, .social-column {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    height: 100%; 
}

.map-wrapper iframe, .info-wrapper iframe {
    width: 100% !important;
    border-radius: 8px;
    display: block;
}

.social-links-wrapper { display: flex; flex-direction: column; gap: 1rem; height: 450px; justify-content: center; }

.social-btn { 
    display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1.5rem; border-radius: 50px; text-decoration: none; font-weight: 600; color: #fff !important; 
    transition: transform 0.2s ease, box-shadow 0.2s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
}
.social-btn:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0,0,0,0.15); color: #fff !important; }
.social-btn svg { flex-shrink: 0; }
.btn-line { background-color: #06c755; }
.btn-youtube { background-color: #ff0000; }
.btn-tiktok { background-color: #000000; }
.btn-instagram { background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); }

.no-iframe-message { height: 450px; background-color: #f0f0f0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #888; border-radius: 8px; }

/* ==========================================
   9. YouTube Slider Section
   ========================================== */
.youtube-slider-section { 
    padding-top: 2rem !important; 
    padding-bottom: 2rem !important; 
    background-color: #f9f9f9; 
}
.youtube-slider-section .section-container { max-width: 1850px !important; width: 98%; margin: 0 auto; padding: 0 1rem; }
.youtube-swiper { padding: 20px 10px 50px 10px !important; }
.video-card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.1); transition: transform 0.3s ease; }
.video-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.video-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.video-content { padding: 1rem; }
.video-title { font-size: 1rem; font-weight: 600; margin: 0; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Swiper Buttons */
.swiper-button-next, .swiper-button-prev { color: var(--primary-green) !important; background: rgba(255,255,255,0.8); width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.swiper-button-next:after, .swiper-button-prev:after { font-size: 18px !important; font-weight: bold; }
.youtube-slider-section .swiper-button-next { right: 0; }
.youtube-slider-section .swiper-button-prev { left: 0; }
.swiper-pagination-bullet-active { background-color: var(--primary-green) !important; }

/* ==========================================
   10. Posts Pagination
   ========================================== */
.posts-pagination { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin-top: 3rem; padding: 1rem 0; flex-wrap: wrap; width: 100%; }
.posts-pagination a, .posts-pagination span.current { display: inline-flex; align-items: center; justify-content: center; padding: 0.6rem 1.2rem; background-color: #ffffff; border: 1px solid #d4e8d4; color: #4a7c59; text-decoration: none; border-radius: 5px; font-weight: 600; font-size: 0.95rem; transition: all 0.3s ease; min-width: 40px; }
.posts-pagination a:hover { background-color: #4a7c59; color: #ffffff; border-color: #4a7c59; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(74, 124, 89, 0.2); }
.posts-pagination span.current { background-color: #4a7c59; color: #ffffff; border-color: #4a7c59; pointer-events: none; }
.posts-pagination .dots { background: transparent; border: none; color: #666; }
@media (max-width: 576px) { .posts-pagination a, .posts-pagination span { min-width: 36px; height: 36px; padding: 0 0.5rem; font-size: 0.85rem; } }

/* ==========================================
   11. Other Sections (Green Office Menu / Footer)
   ========================================== */
.site-content { max-width: 1900px; margin: 0.5rem auto; padding: 0 0.5rem; }
.green-office-header { background-color: #4a7c59; padding: 0; }
.green-office-navigation { max-width: 1400px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.green-office-logo-link { display: flex; align-items: center; padding: 0.4rem 1.5rem 0.4rem 0; transition: opacity 0.3s ease; }
.green-office-logo-link:hover { opacity: 0.9; }
.green-office-logo-img { height: 70px; width: auto; object-fit: contain; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.green-office-logo-img:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }
.green-office-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; }
.green-office-menu li { margin: 0; }
.green-office-menu a { display: block; padding: 0.7rem 0.9rem; color: var(--white); text-decoration: none; font-size: 0.9rem; font-weight: 500; border-right: 1px solid rgba(255, 255, 255, 0.2); transition: background-color 0.3s ease; white-space: nowrap; }
.green-office-menu li:last-child a { border-right: none; }
.green-office-menu .menu-item-has-children { position: relative; }
.green-office-menu .sub-menu { position: absolute; top: 100%; left: 0; background-color: var(--white); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); border-radius: 0 0 8px 8px; min-width: 200px; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s ease; z-index: 1000; padding: 0; margin: 0; list-style: none; }
.green-office-menu .menu-item-has-children:hover .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.green-office-menu .sub-menu li { display: block; width: 100%; }
.green-office-menu .sub-menu li a { display: block; padding: 0.75rem 1.5rem; color: var(--text-dark); background-color: var(--white); border-right: none; border-bottom: 1px solid #f0f0f0; transition: background-color 0.3s ease, color 0.3s ease; white-space: nowrap; }
.green-office-menu .sub-menu li a:hover { background-color: var(--primary-green); color: var(--white); }

/* Footer */
.site-footer { 
    background-color: var(--dark-green); 
    color: var(--white); 
    padding: 2rem; 
    text-align: center; 
    margin-top: 0 !important; /* เปลี่ยนเป็น 0 แล้วใส่ !important เพื่อบังคับให้ติดกัน */
}
/* ==================================================
   12. MOBILE MENU & RESPONSIVE (All Fixes)
   ================================================== */
/* Desktop: Hide Hamburger */
@media (min-width: 1200px) { .mobile-menu-toggle { display: none !important; } }

/* Mobile/Tablet (< 1200px) */
@media (max-width: 1199px) {
    .mobile-menu-toggle { display: flex !important; position: absolute; top: 25px; right: 20px; z-index: 9999; cursor: pointer; background: transparent; border: 2px solid #ddd; border-radius: 4px; width: 45px; height: 45px; justify-content: center; align-items: center; flex-direction: column; }
    .mobile-menu-toggle .hamburger-line { width: 25px; height: 3px; background-color: #333 !important; margin: 2px 0; display: block; transition: all 0.3s ease; }
    .mobile-menu-toggle.active .hamburger-line:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .mobile-menu-toggle.active .hamburger-line:nth-child(2) { opacity: 0; }
    .mobile-menu-toggle.active .hamburger-line:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    .main-navigation { display: block !important; position: fixed !important; top: 0; right: -100%; width: 280px; height: 100vh; background-color: #ffffff; z-index: 9998; padding-top: 80px; box-shadow: -5px 0 15px rgba(0,0,0,0.2); transition: right 0.3s ease-in-out !important; visibility: visible !important; }
    .main-navigation.active { right: 0 !important; }
    .main-navigation ul { flex-direction: column; gap: 0; }
    .main-navigation li { border-bottom: 1px solid #f5f5f5; width: 100%; }
    .main-navigation a { padding: 15px 25px; display: block; }
    .main-navigation .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; padding-left: 1rem; background: #f9f9f9; display: block; border: none; }
    .main-navigation .sub-menu a { border-bottom: 1px solid #e0e0e0; }
    .main-navigation .sub-menu .menu-item-has-children > a::after { display: none; }

    /* Full Width Fixes */
    .green-office-statistics .section-container, 
    .latest-posts-section .section-container,
    .youtube-slider-section .section-container { width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .statistics-grid, .posts-grid, .youtube-swiper { width: 100% !important; margin: 0 !important; }
    .stat-graph-card, .stat-graph-header, .post-card { border-radius: 0 !important; box-shadow: none !important; }
    .statistics-grid { gap: 10px !important; } 
    .stat-graph-card { margin-bottom: 10px; }
    .carousel-slides { height: 500px; }
}

@media (max-width: 1024px) {
    .map-info-grid { grid-template-columns: 1fr; gap: 2rem; }
    .social-links-wrapper { height: auto; padding: 1rem 0; }
    .map-wrapper iframe, .info-wrapper iframe, .no-iframe-message { height: 350px !important; }
}

@media (max-width: 768px) {
    .carousel-slides { height: 350px; }
    .statistics-grid { grid-template-columns: 1fr; }
    .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 5px !important; }
    h1, h2, h3, h4, h5, h6 { text-align: center !important; }
    .stat-graph-footer, .posts-pagination { justify-content: center !important; }
}

@media (max-width: 480px) {
    .carousel-slides { height: 250px; }
    .posts-grid { grid-template-columns: 1fr; }
}

/* ====================================================================
   13. Building & Nature Section (FINAL CONSOLIDATED & CORRECTED)
   Structure: Grey BG | Full Width | 70% Text - 30% Gallery
   ==================================================================== */

/* 1. Reset & Full Width Grey Background */
.building-nature-section {
    background-color: #e6e6e6; /* พื้นหลังสีเทา */
    
    /* เทคนิค Full Width (ทะลุกรอบ Container) */
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    
    /* ระยะห่างภายใน */
    padding-top: 30px;
    padding-bottom: 30px;
    
    /* สั่งให้ติด Footer ด้านล่าง (ลบขอบขาวล่างสุด) */
    margin-bottom: 0 !important;
    
    /* สีตัวอักษรหลัก (สีเข้มเพราะพื้นหลังเทา) */
    color: #333333;
    overflow-x: hidden;
}

/* 2. Container เนื้อหา (ให้อยู่กึ่งกลางหน้าจอ) */
.building-content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 3. Grid Layout (ซ้าย-ขวา) */
.building-grid {
    display: flex;
    justify-content: space-between;
    align-items: center; /* จัดกึ่งกลางแนวตั้ง */
    gap: 40px;
}

/* --- COLUMN CONFIGURATION (70/30 SPLIT) --- */

/* คอลัมน์ซ้าย (ข้อความ) : กินพื้นที่ 70% */
.building-text-col {
    flex: 0 0 70%;
    max-width: 70%;
}

/* คอลัมน์ขวา (รูปภาพ) : กินพื้นที่ 30% */
.building-gallery-col {
    flex: 0 0 30%;
    max-width: 30%;
    
    /* จัดเรียงรูปภายในพื้นที่ 30% */
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: flex-end; /* ให้รูปชิดขวา */
}

/* --- TEXT STYLES --- */
.building-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #2d5a3d; /* สีหัวข้อ (เขียวเข้ม) */
    border-bottom: 3px solid #81c784;
    display: inline-block;
    padding-bottom: 5px;
}

.contact-org-name {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #000000; /* ชื่อหน่วยงานสีดำเข้ม */
}

.contact-org-sub {
    font-size: 0.95rem;
    color: #555555;
    margin-bottom: 25px;
}

.contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    font-size: 1rem;
    color: #444444;
}

.contact-icon {
    margin-right: 15px;
    font-size: 1.2rem;
    min-width: 25px;
}

/* --- GALLERY STYLES --- */
.gallery-item {
    width: 120px;
    height: 120px;
    
    /* Transparent Background (No White Box) */
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.gallery-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* --- RESPONSIVE FIXES (สำคัญ) --- */
@media (max-width: 991px) {
    .building-grid {
        flex-direction: column; /* เรียงลงมา */
        text-align: center;
    }

    /* Reset columns to 100% width on Mobile/Tablet */
    .building-text-col,
    .building-gallery-col {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .building-gallery-col {
        justify-content: center; /* จัดรูปกึ่งกลาง */
        margin-top: 30px;
    }

    .contact-list li {
        justify-content: center; /* จัดรายการติดต่อกึ่งกลาง */
        text-align: left;
    }
    
    .building-title {
        display: inline-block;
    }
}

@media (max-width: 480px) {
    .gallery-item {
        width: 100px; /* ลดขนาดรูปในมือถือเล็กน้อย */
        height: 100px;
    }
}
/* =========================================================
   จัดการทิศทางเมนูย่อย (Sub-Menu Direction)
   ========================================================= */

/* --- 1. เมนูย่อยระดับแรก (Level 2) : ให้ตกลงมาด้านล่าง --- */
.main-navigation > ul > li > .sub-menu,
.green-office-menu > li > .sub-menu {
    top: 100%;  /* อยู่ใต้เมนูแม่ */
    left: 0;    /* ชิดซ้าย */
    display: block;
    /* ซ่อนไว้ก่อน (รอ hover) */
    opacity: 0; 
    visibility: hidden;
    position: absolute;
    z-index: 999;
}

/* สั่งให้แสดงเมื่อเอาเมาส์ชี้เมนูแม่ */
.main-navigation > ul > li:hover > .sub-menu,
.green-office-menu > li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
}


/* =========================================================
   แก้ไข: เมนูย่อยระดับ 3 (Level 3) ให้เลื่อนลงด้านล่าง (Stack Down)
   ========================================================= */

.main-navigation .sub-menu .sub-menu,
.green-office-menu .sub-menu .sub-menu {
    /* 1. ยกเลิกการลอยตัว (เพื่อให้มันดันเมนูอื่นลงไปข้างล่าง) */
    position: relative !important; 
    
    /* 2. รีเซ็ตตำแหน่ง ไม่ให้เด้งไปขวา */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    
    /* 3. สั่งให้กว้างเต็ม เพื่อแสดงซ้อนลงมา */
    width: 100% !important;
    min-width: 100% !important;
    
    /* 4. ปรับแต่งให้ดูเป็นชั้นย่อย (ลบเงาและใส่พื้นหลังต่างสี) */
    margin-top: 0;
    box-shadow: none !important; 
    border-radius: 0;
    border-top: 1px solid #eee; /* เส้นคั่นบางๆ */
    background-color: #f9f9f9; /* สีเทาจางๆ เพื่อให้รู้ว่าเป็นเมนูย่อย */
    
    /* เริ่มต้นซ่อนไว้ */
    display: none; 
    opacity: 0;
    visibility: hidden;
}

/* --- สั่งให้แสดงผลเมื่อเอาเมาส์ชี้ --- */
.main-navigation .sub-menu li:hover > .sub-menu,
.green-office-menu .sub-menu li:hover > .sub-menu {
    display: block; /* แสดงผลแบบ Block เพื่อดันบรรทัดอื่นลง */
    opacity: 1;
    visibility: visible;
}

/* --- จัดย่อหน้าข้อความ (Indentation) ให้ดูออกว่าเป็นข้อย่อย --- */
.main-navigation .sub-menu .sub-menu li a,
.green-office-menu .sub-menu .sub-menu li a {
    padding-left: 2.5rem !important; /* ขยับข้อความเข้าไปทางขวา */
    color: #666; /* สีตัวอักษรจางลงนิดนึง */
    font-size: 0.9rem;
}

/* --- (เสริม) เปลี่ยนลูกศรให้ชี้ลง (ถ้ามี) --- */
.main-navigation .sub-menu .menu-item-has-children > a::after { 
    content: '▼' !important; /* เปลี่ยนลูกศรเป็นหัวทิ่มลง */
    font-size: 0.6rem;
    float: right;
    transform: none !important;
    margin-top: 4px;
}
/* =========================================================
   แก้ไขปัญหา: เมนูหายเร็ว / คลิกไม่ทัน (Fix Menu Disappearing Fast)
   ========================================================= */

/* 1. ตั้งค่าการหน่วงเวลาให้กับเมนูย่อยทุกระดับ */
.main-navigation .sub-menu,
.green-office-menu .sub-menu,
.main-navigation .sub-menu .sub-menu,
.green-office-menu .sub-menu .sub-menu {
    /* ใช้เทคนิค Visibility แทน Display เพื่อให้ Animation ทำงานได้ */
    display: block !important; /* บังคับให้โครงสร้างมาตลอด */
    
    /* ซ่อนด้วยความสูงและ Opacity แทน */
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    
    /* Animation การแสดงผล */
    transition: all 0.4s ease-in-out;
    
    /* --- หัวใจสำคัญ: หน่วงเวลาตอนปิด 0.4 วินาที --- */
    transition-delay: 0.5s; 
    
    /* ดึงเมนูขึ้นมาเกยกับตัวแม่เล็กน้อย เพื่อไม่ให้มีช่องว่างให้เมาส์หลุด */
    margin-top: -2px !important; 
}

/* 2. เมื่อเอาเมาส์ชี้ (Hover) */
.main-navigation li:hover > .sub-menu,
.green-office-menu li:hover > .sub-menu,
.main-navigation .sub-menu li:hover > .sub-menu,
.green-office-menu .sub-menu li:hover > .sub-menu {
    /* แสดงผลทันที */
    max-height: 2000px; /* ปล่อยความสูงให้ยืดสุด */
    opacity: 1;
    visibility: visible;
    
    /* ตอนเมาส์เข้า ไม่ต้องรอ (แสดงทันที) */
    transition-delay: 0s; 
}

/* 3. เพิ่มพื้นที่กันพลาด (Invisible Bridge) */
/* สร้างพื้นที่โปร่งใสรอบๆ เมนูย่อย เพื่อให้เมาส์ไม่หลุดง่ายๆ */
.main-navigation li > .sub-menu::before,
.green-office-menu li > .sub-menu::before {
    content: "";
    position: absolute;
    top: -10px; /* เพิ่มพื้นที่ด้านบน 10px */
    left: -10px;
    right: 0;
    height: 20px; /* ความสูงของสะพานเชื่อม */
    background: transparent; /* โปร่งใส มองไม่เห็น */
    z-index: 1;
}
