/* --- Color Palette Variables --- */
:root {
    --primary-100: #ff7f00;
    --primary-200: #f93;
    --primary-300: #ffb266;
    --accent-100: #ffc266;
    --accent-200: #ffc266;
    --accent-300: #ffc266;
    --background-100: #fffcf9;
    --background-200: #ffefe0;
    --background-300: #ffe3c6;
    --text-100: #231100;
    --text-200: #562a00;
    --text-300: #894300;
}

/* --- General Styles --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background-color: var(--background-100);
    color: var(--text-200);
    line-height: 1.6;
}

.content-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

section {
    background-color: rgba(255, 255, 255, 0.95); /* สีขาวทึบแสง 95% */
    margin-bottom: 20px;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); /* เพิ่มเงาให้เด่นชัด */
}

h1, h2, h3 {
    color: var(--text-300);
}

h1 {
    text-align: center;
    margin-bottom: 40px;
}

/* --- Navigation Bar --- */
nav {
    background-color: var(--primary-100);
    color: var(--background-100);
    padding: 0rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.4s ease-in-out;
}

.nav--hidden {
    transform: translateY(-120%);
    box-shadow: none;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav .logo img {
    height: 60px;
    display: block;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    color: var(--background-100);
    text-decoration: none;
    font-weight: 500;
    padding: 5px 5px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

nav ul li a:hover {
    background-color: var(--primary-200);
}

/* --- Button --- */
.btn {
    display: inline-block;
    background-color: var(--primary-100);
    color: var(--background-100);
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 15px;
    transition: background-color 0.3s;
    border: none;
}

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

/* --- Personnel Cards --- */
.personnel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    justify-content: center;
}

.card {
    background-color: var(--background-200);
    border: 1px solid var(--background-300);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 10px;
    object-fit: cover;
}

.card h3 {
    margin: 8px 0 4px 0;
    color: var(--text-200);
    font-size: 0.95em;
}

.card h4 {
    margin: 4px 0;
    color: var(--text-300);
    font-size: 0.85em;
    font-weight: normal;
}

.card .title-th,
.card .title-en,
.card .email {
    margin: 4px 0;
    font-size: 0.85em;
}

/* Responsive for mobile */
@media (max-width: 768px) {
    .personnel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .card {
        padding: 12px;
    }

    .card img {
        width: 70px;
        height: 70px;
    }

    .card h3 {
        font-size: 0.9em;
    }

    .card h4,
    .card .title-th,
    .card .title-en,
    .card .email {
        font-size: 0.8em;
    }
}

.card p {
    font-size: 0.9rem;
    color: var(--text-200);
    margin: 0;
}

/* --- Tools List --- */
/* Tools Page - 2 Column Grid for Featured Tools */
.tools-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.tool-card.featured {
    background-color: rgba(255, 255, 255, 0.98);
    padding: 30px;
    border-radius: 12px;
    border-left: 5px solid var(--primary-100);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-card.featured:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.tool-card.featured h3 {
    color: var(--primary-100);
    font-size: 1.3rem;
    margin-top: 0;
    margin-bottom: 15px;
}

.tool-card.featured p {
    color: var(--text-200);
    line-height: 1.8;
    margin-bottom: 20px;
}

/* Responsive - Stack on mobile */
@media (max-width: 768px) {
    .tools-grid-2col {
        grid-template-columns: 1fr;
    }
}

.tool-item {
    border-left: 3px solid var(--accent-100);
    padding-left: 15px;
    margin-bottom: 20px;
}

/* --- Language Toggle Button (Floating Bottom Right) --- */
.lang-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary-100);
    border: 3px solid var(--background-100);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 999;
}

.lang-toggle-btn:hover {
    background-color: var(--primary-200);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.lang-toggle-btn .flag-icon {
    font-size: 32px;
    line-height: 1;
    display: block;
}

@media (max-width: 768px) {
    .lang-toggle-btn {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }

    .lang-toggle-btn .flag-icon {
        font-size: 28px;
    }
}

/* --- Hamburger Menu & Responsive --- */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: var(--background-100);
    border-radius: 5px;
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }
    nav ul {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: var(--primary-100);
        flex-direction: column;
        text-align: center;
        padding-bottom: 15px;
    }
    nav ul li {
        margin: 15px 0;
    }
    nav ul.nav-links--active {
        display: flex;
    }
    .two-column-layout {
        flex-direction: column;
    }
}

/* --- Specific Page Styles --- */
#personnel .card img {
    width: 188px;
    height: 188px;
}

.intro-heading .subtitle, .subtitle {
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-300);
    text-align: center;
    margin: 0 auto 30px auto;
    max-width: 800px;
}

.intro-logo {
    display: block;
    margin: 30px auto;
    max-width: 400px;
    width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .intro-logo {
        max-width: 280px;
    }
}

.two-column-layout {
    display: flex;
    align-items: center;
    gap: 40px;
}

.column {
    flex: 1;
}

.column img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.column-right {
    text-align: left;
}

/* --- Styles for Contact Page Personnel (Fix) --- */

/* 1. จัดเลย์เอาต์ 2 ชั้นให้กลับมาอยู่กลาง */
.personnel-tier {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}
.personnel-tier.specialist {
    flex-wrap: wrap;
}

/* 2. จัดเนื้อหาใน Card ให้อยู่กลางและสวยงาม */
#personnel .card {
    text-align: center; /* ทำให้เนื้อหาใน card อยู่กลาง */
}

#personnel .card img {
    width: 188px;
    height: 188px;
}

#personnel .card h2 {
    font-size: 1.2rem;
    margin: 10px 0 5px 0;
}

#personnel .card h3 {
    font-size: 1rem;
    font-weight: 400;
    margin: 0 0 10px 0;
    color: var(--text-200);
}

.card .title-th {
    font-weight: 500;
    color: var(--text-200);
    margin: 10px 0 0 0;
}
.card .title-en {
    font-size: 0.85rem;
    color: #894300; /* ใช้สีเข้มขึ้นเล็กน้อย */
    font-style: italic;
    margin: 2px 0 10px 0;
}
.card .email {
    font-size: 0.9rem;
    color: var(--text-200);
    margin: 0;
}
/* จัดกลางเนื้อหาใน Section Personnel Promo */
#personnel-promo {
    text-align: center;
}

/* --- Styles for Two Column Layout --- */

.two-column-layout {
    display: flex;
    align-items: center;
    gap: 40px;
}

.column {
    flex: 1;
}

.column img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.column-right {
    text-align: left;
}

/* Responsive for Mobile */
@media (max-width: 768px) {
    .two-column-layout {
        flex-direction: column;
    }
}

/* --- Footer Styles --- */
footer {
    background-color: var(--text-100); /* ใช้สีน้ำตาลเข้มสุดจาก Palette */
    color: var(--background-200); /* ใช้สีครีมอ่อนสำหรับตัวอักษร */
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 40px; /* เพิ่มระยะห่างจาก section สุดท้าย */
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* --- Form Styles (Improved Version) --- */
.form-section {
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 40px;
}

.form-group {
    margin-bottom: 30px;
}

.form-group > label { /* Target only direct child label */
    display: block;
    font-weight: bold;
    margin-bottom: 12px;
    font-size: 1.2rem;
    color: var(--primary-100);
}

.form-group .factor-description {
    font-size: 0.9rem;
    color: #ccc;
    margin-top: -8px;
    margin-bottom: 15px;
    font-style: italic;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    width: 100%;
    max-width: 500px; /* จำกัดความกว้างไม่ให้ยาวเกินไป */
    padding: 12px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 1rem;
}

.radio-group {
    display: flex;
    gap: 25px; /* จัดแนวนอนสำหรับ Gender */
}

.radio-group.vertical {
    flex-direction: column; /* จัดแนวตั้งสำหรับคำถามอื่นๆ */
    gap: 10px;
}

.radio-group label {
    display: flex; /* ทำให้ปุ่มกับข้อความอยู่แนวเดียวกัน */
    align-items: center;
    font-weight: normal;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.radio-group label:hover {
    border-color: var(--primary-100);
    background-color: rgba(255, 255, 255, 0.1);
}

.radio-group input[type="radio"] {
    margin-right: 12px;
    /* ทำให้ปุ่ม radio ใหญ่ขึ้นและเห็นง่าย */
    width: 18px;
    height: 18px;
}

.form-submit-area {
    text-align: center;
    margin-top: 50px;
}

/* --- Typewriter Effect Styles --- */
.typewriter {
  display: inline-block; /* ทำให้กรอบพอดีกับข้อความ */
  overflow: hidden; /* ซ่อนข้อความที่ยังไม่ถูกพิมพ์ */
  white-space: nowrap; /* ป้องกันการขึ้นบรรทัดใหม่ระหว่างพิมพ์ */
  border-right: 0.15em solid var(--primary-100); /* สร้างเคอร์เซอร์สีส้ม */
  animation: 
    typing 3.5s steps(40, end) forwards, /* อนิเมชันการพิมพ์ */
    blink-caret .75s step-end infinite; /* อนิเมชันเคอร์เซอร์กะพริบ */
}

/* อนิเมชันการพิมพ์: ขยายความกว้างจาก 0% ไป 100% */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

/* อนิเมชันเคอร์เซอร์กะพริบ */
@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--primary-100); }
}