/* --- Global Styles --- */
:root {
    --primary-color: #79A389; /* สีเขียวอ่อนๆ */
    --secondary-color: #B4CFB0; /* สีเขียวกลาง */
    --accent-color: #FFDAB9; /* สีส้มพีช */
    --text-color: #333;
    --light-text-color: #666;
    --white-color: #fff;
    --dark-color: #2c3e50;
    --font-family: 'Sarabun', sans-serif;
    --transition-duration: 0.3s; /* Global transition duration */
}

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

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white-color);
    overflow-x: hidden; /* Prevent horizontal scroll from transitions */
}

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

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color var(--transition-duration) ease; /* Smooth transition for links */
}

ul {
    list-style: none;
}

.btn {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white-color);
    padding: 12px 25px; /* Slightly larger padding */
    border-radius: 5px;
    transition: background var(--transition-duration) ease, transform var(--transition-duration) ease;
    margin-top: 15px;
    font-size: 1.1em; /* Slightly larger font */
}

.btn:hover {
    background: var(--secondary-color);
    transform: translateY(-3px); /* Subtle lift effect */
}

.btn-small {
    background: var(--accent-color);
    color: var(--dark-color);
    padding: 8px 15px;
    border-radius: 3px;
    font-size: 0.9em;
    transition: background var(--transition-duration) ease, transform var(--transition-duration) ease;
}

.btn-small:hover {
    background: var(--primary-color);
    color: var(--white-color);
    transform: translateY(-2px); /* Subtle lift effect */
}

/* --- Header --- */
header {
    background: var(--dark-color);
    color: var(--white-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); /* Stronger shadow */
}

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

.logo {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--white-color);
    transition: transform var(--transition-duration) ease;
}

.logo:hover {
    transform: scale(1.05); /* Slight zoom on hover */
}

header nav ul {
    display: flex;
}

header nav ul li {
    margin-left: 30px;
}

header nav ul li a {
    color: var(--white-color);
    font-weight: 400;
    position: relative;
}

header nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    left: 0;
    bottom: -5px;
    transition: width var(--transition-duration) ease-in-out; /* Underline transition */
}

header nav ul li a:hover::after {
    width: 100%;
}

/* Hamburger Menu (Mobile) */
.hamburger-menu {
    display: none; /* Hidden on PC */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    cursor: pointer;
    z-index: 1100; /* Ensure it's above other content on mobile */
}

.hamburger-menu .bar {
    width: 100%;
    height: 3px;
    background-color: var(--white-color);
    transition: all var(--transition-duration) ease-in-out;
}

/* Hamburger active state for animation */
.hamburger-menu.active .bar:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}
.hamburger-menu.active .bar:nth-child(2) {
    opacity: 0;
}
.hamburger-menu.active .bar:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* --- Hero Section --- */
.hero-section {
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://via.placeholder.com/1500x800/79A389/FFFFFF?text=Natural+Flowers') no-repeat center center/cover;
    color: var(--white-color);
    text-align: center;
    padding: 100px 20px;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden; /* Hide overflow for potential animations */
}

.hero-section h2, .hero-section p, .hero-section .btn {
    animation: fadeInSlideUp 1s ease-out forwards; /* Animation for text and button */
    opacity: 0; /* Start invisible */
}

.hero-section h2 { animation-delay: 0.2s; }
.hero-section p { animation-delay: 0.4s; }
.hero-section .btn { animation-delay: 0.6s; }

/* --- Sections Styling --- */
section {
    padding: 80px 0;
    text-align: center;
    opacity: 0; /* Initial state for scroll animation */
    transform: translateY(50px); /* Initial state for scroll animation */
    transition: opacity 0.8s ease-out, transform 0.8s ease-out; /* Transition for scroll reveal */
}

/* Class to apply when section is in view */
section.visible {
    opacity: 1;
    transform: translateY(0);
}

section h3 {
    font-size: 2.5em;
    margin-bottom: 40px;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 10px;
}

section h3::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--accent-color);
    transition: width var(--transition-duration) ease-in-out; /* Underline transition */
}

/* Products Section */
.products-section {
    background-color: var(--white-color);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.product-item {
    background: var(--white-color);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); /* Stronger shadow */
    transition: transform var(--transition-duration) ease, box-shadow var(--transition-duration) ease;
}

.product-item:hover {
    transform: translateY(-8px); /* More pronounced lift */
    box-shadow: 0 8px 16px rgba(0,0,0,0.15); /* More pronounced shadow */
}

.product-item img {
    max-width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 15px;
    transition: transform 0.4s ease; /* Zoom on image hover */
}

.product-item:hover img {
    transform: scale(1.05);
}

.product-item h4 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.product-item p {
    color: var(--light-text-color);
    margin-bottom: 15px;
    font-size: 0.95em;
}

.product-item .price {
    font-size: 1.3em;
    color: var(--primary-color);
    font-weight: 700;
    display: block;
    margin-bottom: 15px;
}

/* About Section */
.about-section {
    background-color: var(--secondary-color);
    color: var(--dark-color);
}

.about-section h3 {
    color: var(--dark-color);
}

.about-section p {
    max-width: 800px;
    margin: 0 auto 20px auto;
    font-size: 1.1em;
    line-height: 1.8;
}

/* Contact Section */
.contact-section {
    background-color: var(--white-color);
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: var(--font-family);
    font-size: 1em;
    transition: border-color var(--transition-duration) ease, box-shadow var(--transition-duration) ease;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(121, 163, 137, 0.2); /* Light primary color glow */
    outline: none;
}

.contact-form textarea {
    resize: vertical;
}

.contact-form button {
    align-self: flex-end;
}

.social-links {
    margin-top: 30px;
    font-size: 1.2em; /* Larger icons */
}

.social-links a {
    margin: 0 15px; /* More spacing */
    color: var(--primary-color);
    font-weight: 700;
    display: inline-flex; /* Align icon and text */
    align-items: center;
}

.social-links a i {
    margin-right: 8px; /* Space between icon and text */
}

.social-links a:hover {
    color: var(--dark-color);
}

/* --- Footer --- */
footer {
    background: var(--dark-color);
    color: var(--white-color);
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
}

footer p {
    font-size: 0.9em;
}

/* --- Keyframe Animations --- */
@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Responsive Design (Mobile) --- */
@media (max-width: 768px) {
    header .container {
        flex-wrap: wrap;
    }

    header nav {
        order: 3;
        flex-basis: 100%;
        margin-top: 15px;
        text-align: center;
        max-height: 0;       /* ต้องมี! ซ่อนเมนูเริ่มต้น */
        overflow: hidden;    /* ต้องมี! ซ่อนเนื้อหาที่เกินมา */
        transition: max-height var(--transition-duration) ease-out; /* ทำให้การแสดงผลนุ่มนวล */
        background-color: var(--dark-color); /* เพิ่ม: อาจจะให้พื้นหลังเมนูตอนเปิดเหมือน header */
        padding-bottom: 15px; /* เพิ่ม: ให้มี padding ด้านล่างเมนู */
    }

    header nav.active {
        max-height: 300px;   /* **สำคัญมาก: ต้องมี และค่าต้องมากพอที่จะแสดงเมนูทั้งหมด** */
        /* หากเมนูยาวมากจนเกิน 300px ให้ลองเพิ่มเป็น 500px, 600px หรือใช้ max-content (ถ้าเบราว์เซอร์รองรับ) */
        /* max-height: max-content; */
        /* max-height: 100vh; /* อีกทางเลือก: สูงเท่า viewport */
    }

    /* ตรวจสอบให้แน่ใจว่าไม่มีคุณสมบัติ display: none; ที่มาขัดขวาง */
    /* หรือ display: block; ที่มาเขียนทับในส่วนที่ผิด */
    header nav ul { /* เพิ่มเติม: หาก navLinks คือ ul โดยตรง */
        flex-direction: column;
        gap: 15px;
        padding-top: 10px;
    }

    header nav ul li {
        margin: 0;
    }

    header nav ul li a {
        color: var(--white-color); /* ตรวจสอบสีลิงก์ในเมนูมือถือ */
        padding: 8px 0; /* เพิ่ม padding ให้กดง่ายขึ้น */
        display: block; /* ทำให้ลิงก์ครอบคลุมพื้นที่ทั้งหมดในแต่ละแถว */
    }

    header nav ul li a:hover {
        color: var(--accent-color);
    }

    header nav ul li a::after {
        display: none; /* ซ่อนเส้นใต้ในเมนูมือถือ */
    }

    .hamburger-menu {
        display: flex;
    }

    .hero-section {
        height: 50vh;
        padding: 80px 20px;
    }

    .hero-section h2 {
        font-size: 2.2em;
    }

    .hero-section p {
        font-size: 1em;
    }

    section {
        padding: 50px 0;
    }

    section h3 {
        font-size: 2em;
    }

    .product-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }

    .product-item {
        margin: 0 10px; /* Add some side margin */
    }

    .about-section p {
        font-size: 1em;
    }

    .social-links {
        flex-direction: column;
        gap: 10px;
    }
    .social-links a {
        margin: 5px 0;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5em;
    }

    .hero-section h2 {
        font-size: 1.8em;
    }

    .hero-section p {
        font-size: 0.9em;
    }

    .btn {
        padding: 10px 20px;
        font-size: 1em;
    }

    section h3 {
        font-size: 1.8em;
    }
}