/* CSS Reset and General Variables */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #059669; /* Emerald Green */
    --primary-hover: #10b981;
    --dark: #0f172a; /* Slate 900 */
    --dark-light: #1e293b; /* Slate 800 */
    --light: #f8fafc; /* Slate 50 */
    --text-white: #ffffff;
    --text-muted: #94a3b8; /* Slate 400 */
    --font-th: 'Sarabun', sans-serif;
    --font-en: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
    --header-height: 80px;
}

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

body {
    font-family: var(--font-th);
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
    padding: 40px 20px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-speed) ease;
}

/* ==========================================================================
   HEADER / NAVIGATION SYSTEM
   ========================================================================== */

header {
    background-color: #0b0f19; /* Deep dark blue-black to match reference image */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: var(--header-height);
    gap: 24px;
}

/* Logo & Brand Style */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.brand a {
    min-width: 0;
}

.brand img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.brand-title {
    color: var(--text-white);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Desktop Navigation Menu */
.site-nav {
    flex: 0 1 auto;
}

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

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--text-white);
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: var(--header-height);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

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

/* Caret Icon indicating children */
.has-children > .nav-link::after {
    content: '';
    display: inline-block;
    margin-left: 6px;
    width: 5px;
    height: 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.has-children:hover > .nav-link::after {
    transform: rotate(-135deg);
}

/* Dropdown styling base (Recursive / Nested) */
.nav-menu ul {
    position: absolute;
    top: var(--header-height);
    left: 0;
    background-color: #111827; /* Dark Grey/Black dropdown container */
    min-width: 240px;
    list-style: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-top: 3px solid var(--primary);
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--transition-speed) ease, 
                transform var(--transition-speed) ease, 
                visibility var(--transition-speed) ease;
    padding: 8px 0;
}

.nav-menu li:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-menu ul li {
    position: relative;
}

.nav-menu ul a {
    color: #cbd5e1; /* Soft slate color */
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 400;
}

.nav-menu ul a:hover {
    background-color: rgba(5, 150, 105, 0.15); /* Primary tint */
    color: var(--text-white);
    padding-left: 24px; /* Slight slide in effect */
}

/* 3rd Level Submenu Positioning (Dropdown inside Dropdown) */
.nav-menu ul ul {
    top: -8px;
    left: 100%; /* Push level 3 to the right of level 2 */
    border-top: none;
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 8px;
}

/* Caret for submenu items that have children */
.nav-menu ul .has-children > a::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg); /* Point right */
    transition: transform 0.2s ease;
}

.nav-menu ul .has-children:hover > a::after {
    transform: rotate(45deg);
}

/* Hamburger button for mobile navigation */
.menu-toggle {
    display: none;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px 10px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-white);
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 3px;
}

/* Toggle Animation */
.menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* ==========================================================================
   MOBILE NAVIGATION (MAX-WIDTH: 1024px)
   ========================================================================== */

@media (max-width: 1024px) {
    :root {
        --header-height: 72px;
    }

    .header-container {
        padding: 0 16px;
        gap: 12px;
    }

    .brand-title {
        font-size: 1.15rem;
        max-width: min(58vw, 520px);
    }

    .menu-toggle {
        display: inline-flex; /* Show hamburger button */
    }

    .site-nav {
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
    }

    /* Transform menu list to slide-down panel */
    .nav-menu {
        width: 100%;
        background-color: #0b0f19;
        flex-direction: column;
        align-items: stretch;
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
        padding: 10px 16px 18px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 18px 32px rgba(0, 0, 0, 0.35);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        pointer-events: none;
        transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease, visibility var(--transition-speed) ease;
    }

    .nav-menu.active {
        display: flex;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-item {
        border-radius: 8px;
        overflow: hidden;
    }

    .nav-link {
        height: auto;
        min-height: 48px;
        padding: 14px 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        justify-content: space-between;
        gap: 12px;
    }

    /* Dropdowns in Mobile - Accordion Style */
    .nav-menu ul {
        position: static;
        width: 100%;
        background-color: rgba(255, 255, 255, 0.04);
        box-shadow: none;
        border-top: none;
        border-left: none;
        border-radius: 8px;
        opacity: 1;
        visibility: visible;
        transform: none;
        padding: 0;
        max-height: 0; /* JS toggles max-height for accordion */
        overflow: hidden;
        transition: max-height 0.4s ease-out;
    }

    /* Class added by JS when dropdown parent is tapped */
    .nav-menu ul.open {
        max-height: 1000px; /* Large value to accommodate children */
    }

    .nav-menu ul li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    }

    .nav-menu ul a {
        padding: 12px 22px; /* Indent level 2 links */
        gap: 12px;
    }

    .nav-menu ul ul {
        background-color: rgba(0, 0, 0, 0.22);
        border-left: none;
        border-radius: 0;
    }

    .nav-menu ul ul a {
        padding: 12px 34px; /* Indent level 3 links */
    }

    /* Adjust Caret icon rotation in accordion */
    .has-children > .nav-link::after {
        transform: rotate(45deg);
    }
    
    .has-children.open > .nav-link::after {
        transform: rotate(-135deg);
    }

    .nav-menu ul .has-children > a::after {
        transform: rotate(45deg);
    }
    
    .nav-menu ul .has-children.open > a::after {
        transform: rotate(-135deg);
    }
}

@media (max-width: 640px) {
    :root {
        --header-height: 64px;
    }

    .header-container {
        padding: 0 12px;
    }

    .brand img {
        height: 42px;
    }

    .brand-title {
        font-size: 1rem;
        max-width: calc(100vw - 124px);
    }

    .nav-menu {
        padding: 8px 12px 16px;
    }
}

/* ==========================================================================
   FOOTER STYLE
   ========================================================================== */

footer {
    background-color: #1e293b; /* Dark theme Slate 800 */
    color: var(--text-white);
    padding: 48px 0 20px 0;
    margin-top: auto;
    border-top: 4px solid var(--primary);
    font-size: 0.95rem;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.footer-card {
    background-color: rgba(15, 23, 42, 0.58);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    padding: 22px;
    min-width: 0;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.footer-col h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-hover);
    margin-bottom: 18px;
    position: relative;
    padding-bottom: 8px;
}

.footer-col h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 2px;
}

.footer-col p {
    color: var(--text-muted);
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: block;
    overflow-wrap: anywhere;
}

.footer-links a:hover {
    color: var(--text-white);
    padding-left: 6px;
}

/* 2-column grid layout for long link lists (e.g. external links) */
.footer-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}

/* Contact Column details styles */
.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
}

.contact-icon.phone {
    background-color: #22c55e; /* Green for telephone */
    color: white;
}

.contact-icon.facebook {
    background-color: #3b82f6; /* Blue for Facebook */
    color: white;
}

.contact-details {
    color: var(--text-muted);
    font-size: 0.9rem;
    min-width: 0;
}

.contact-details a {
    overflow-wrap: anywhere;
}

.contact-details strong {
    color: var(--text-white);
    display: block;
    margin-bottom: 2px;
}

/* Footer Bottom Bar */
.footer-bottom {
    max-width: 1400px;
    margin: 40px auto 0 auto;
    padding: 24px 24px 0 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-bottom-links a {
    margin-left: 20px;
}

.footer-bottom-links a:hover {
    color: var(--text-white);
}

@media (max-width: 768px) {
    footer {
        padding-top: 28px;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 16px;
    }

    .footer-card {
        padding: 18px;
    }

    .footer-links-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        margin-top: 24px;
        padding: 20px 16px 0;
    }
    
    .footer-bottom-links a {
        margin: 0 10px;
    }
}

@media (min-width: 769px) and (max-width: 1180px) {
    .footer-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ==========================================================================
   REUSABLE UTILITY COMPONENTS
   ========================================================================== */

.btn {
    display: inline-block;
    background-color: var(--primary);
    color: var(--text-white);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color var(--transition-speed);
    cursor: pointer;
    border: none;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    margin-left: 12px;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.card {
    background-color: var(--text-white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark);
}

.card-desc {
    color: #475569;
    font-size: 0.95rem;
}
