/* === 1. GLOBAL SETUP & VARIABLES === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color, #333);
    background-color: #ffffff; /* พื้นหลังหลักเป็นสีขาว */
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

a {
    text-decoration: none;
    color: var(--primary-dark);
    transition: color 0.3s;
}

a:hover {
    color: var(--accent-teal);
}

.bg-light {
    background-color: var(--light-bg, #f4f8fb);
    padding: 60px 0;
}

/* ปุ่มหลัก (Primary Button - สำหรับ Search) */
.btn-primary {
    background-color: var(--accent-teal);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #1aa8a8; /* Teal เข้มขึ้นเล็กน้อย */
    color: white;
}

.text-center {
    text-align: center;
}


/* === 2. HEADER & NAVIGATION === */
.main-header {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    padding: 8px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo img {
    height: 54px; /* ปรับขนาดโลโก้ให้พอดี */
}

.main-nav a {
    margin-left: 25px;
    font-weight: 500;
    color: var(--primary-dark);
}

/* Policy links (Business Policies, Privacy Policy) use the same .main-nav a style above */

.main-nav a.active {
    color: var(--accent-teal);
}

.main-nav a.cta-button {
    background-color: var(--accent-teal);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
}

.main-nav a.cta-button:hover {
    background-color: #1aa8a8;
    color: white;
}

.menu-toggle {
    display: none; /* ซ่อนสำหรับ Desktop */
}

/* === 3. HERO SECTION === */
.hero-section {
    background-size: cover;
    background-position: center;
    height: 500px; /* ความสูงเริ่มต้น */
    display: flex;
    align-items: center;
    position: relative;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 35, 78, 0.5); /* Overlay สีน้ำเงินเข้มจากโลโก้ */
    display: flex;
    align-items: center;
}

.hero-section h1 {
    color: white;
    font-size: 3em;
    text-align: center;
    margin-bottom: 30px;
}

/* Search Widget Styling */
.search-widget {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 900px;
    margin: 0 auto;
}

.search-widget select {
    height: 50px; /* ทำให้ select มีความสูงเท่ากับ input ทั่วไป */
    appearance: none; /* ลบสไตล์ default ของ browser (ถ้าต้องการ custom icon ด้านหลัง) */
}

.search-widget form {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-group {
    flex-grow: 1;
}

.search-widget input[type="text"],
.search-widget input[type="date"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.search-button {
    height: 50px; /* ให้ปุ่มค้นหาเท่ากับความสูงของ input */
    white-space: nowrap;
}

/* === 4. FEATURED CATEGORIES (REVISED) === */
.featured-categories {
    padding: 80px 0;
}

.featured-categories h2 {
    text-align: center;
    margin-bottom: 40px;
    color: var(--primary-dark);
}

.category-list {
    display: flex;
    justify-content: space-between; /* ใช้ space-between เพื่อกระจายช่องว่าง */
    gap: 20px;
    text-align: center;
    flex-wrap: wrap; /* **สำคัญ: อนุญาตให้รายการขึ้นบรรทัดใหม่** */
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* ใช้ flex-basis แทน flex-grow เพื่อควบคุมขนาด */
    flex-basis: 22%; /* ทำให้มี 4 คอลัมน์พอดีๆ (100/4 = 25% แต่เผื่อ gap) */
    margin-bottom: 20px; /* เพิ่ม margin ด้านล่าง */
    text-decoration: none; /* ให้ลิงก์ไม่ขีดเส้นใต้ */
    color: var(--text-color);
}

/* === 5. FEATURED SERVICES (CARDS) === */
.featured-services {
    padding: 80px 0;
}

.featured-services h2 {
    text-align: center;
    margin-bottom: 40px;
    color: var(--primary-dark);
}

.service-grid {
    display: grid;
    /* ปรับจาก auto-fit, minmax(280px, 1fr) เป็น 4 คอลัมน์คงที่สำหรับ Desktop */
    grid-template-columns: repeat(4, 1fr); 
    gap: 30px;
}

.service-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s;
}

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

.service-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-content {
    padding: 15px;
}

.card-content h3 {
    font-size: 1.2em;
    margin-bottom: 5px;
    color: var(--primary-dark);
}

.location {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.price .amount {
    font-size: 1.4em;
    color: var(--accent-teal);
    font-weight: bold;
}

.btn-view-details {
    background-color: var(--primary-dark);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.9em;
}
.btn-view-details:hover {
    background-color: var(--accent-teal);
}

.btn-view-all {
    display: inline-block;
    margin-top: 40px;
    padding: 12px 30px;
    border: 2px solid var(--accent-teal);
    color: var(--accent-teal);
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s;
}
.btn-view-all:hover {
    background-color: var(--accent-teal);
    color: white;
}

/* === 6. RESPONSIVENESS (Mobile First Adjustment) === */

@media (max-width: 992px) {
    /* ปรับ Hero Section */
    .hero-section {
        height: 400px;
    }
    .hero-section h1 {
        font-size: 2.5em;
    }
    
    /* ปรับ Search Widget */
    .search-widget form {
        flex-direction: column;
    }
    .search-widget input, .search-button {
        width: 100%;
    }
    .search-button {
        height: auto;
        padding: 12px 0;
    }
}

/* === 7. SEARCH RESULTS PAGE LAYOUT === */
.search-page-layout {
    padding-top: 40px;
    padding-bottom: 80px;
    display: flex;
    flex-direction: column;
}

.search-summary-box {
    background-color: var(--light-bg);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 5px solid var(--accent-teal);
}

.search-summary-box h3 {
    margin-bottom: 5px;
    color: var(--primary-dark);
}

.main-content-area {
    display: flex;
    gap: 30px;
}

/* Sidebar */
.filter-sidebar {
    flex: 0 0 250px; /* Sidebar กว้าง 250px */
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: fit-content; /* ให้ Sidebar ติดอยู่กับที่ */
}

.filter-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.filter-group h5 {
    margin-bottom: 10px;
    font-size: 1em;
    color: var(--primary-dark);
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95em;
}

/* Results List */
.results-list {
    flex-grow: 1;
}

.search-result-card {
    /* ใช้ Card Design เดิม แต่ปรับให้ Card Footer แสดงราคาต่อคน/ราคารวม */
}

.service-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.type-tag {
    background-color: #e0f7fa;
    color: var(--accent-teal);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

/* === 8. STYLING FOR SEARCH RESULTS PAGE ELEMENTS === */

/* Badges & Tags */
.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 5px;
}

.badge-popular {
    background-color: var(--primary-dark);
    color: white;
    padding: 5px 10px;
    border-radius: 5px 0 5px 0;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

/* Rating & Icons */
.rating {
    color: gold;
    font-size: 1.1em;
    margin-right: 5px;
}

.icon-feature {
    font-size: 1.1em;
    margin-right: 5px;
}

.free-cancellation {
    color: var(--accent-teal);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

/* Result Card Refinement (ใช้ใน search_results.php) */
.search-result-card {
    display: flex;
    gap: 20px;
    padding: 15px;
    margin-bottom: 20px; /* เพิ่มช่องว่างระหว่างรายการ */
    border: 1px solid #eee;
    border-radius: 8px;
    position: relative; /* สำหรับ badge-popular */
}

.search-result-card img {
    width: 150px; /* กำหนดขนาดภาพรถ/เรือ */
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.search-result-card .card-content {
    flex-grow: 1;
    padding: 0; /* ลบ padding ที่เคยมี */
}

.card-footer {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-footer .btn-view-details {
    padding: 10px 20px;
}

.service-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.service-meta .price {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-dark);
}

/* Sidebar Refinement (Filter) */
.filter-sidebar {
    flex: 0 0 280px; /* ขยาย Sidebar เล็กน้อย */
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: fit-content;
}

/* === 9. BOOKING DETAIL PAGE STYLING === */

.booking-page {
    padding: 40px 0;
}

.page-title {
    color: var(--primary-dark);
    margin-bottom: 30px;
    text-align: center;
}

.booking-layout {
    display: flex;
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
}

/* === 10. SUCCESS PAGE STYLING === */
.success-container {
    padding: 80px 0;
    display: flex;
    justify-content: center;
}

.success-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    text-align: center;
    max-width: 600px;
    border-top: 8px solid var(--accent-teal);
}

.success-box i {
    font-size: 4em;
    color: #28a745; /* Green checkmark */
    margin-bottom: 20px;
}

.success-box h2 {
    color: var(--primary-dark);
    margin-bottom: 15px;
}

.summary-details {
    text-align: left;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: 5px;
    margin-top: 20px;
}

.final-total-success {
    font-size: 1.5em;
    color: var(--accent-teal);
    margin-top: 20px;
}

.note {
    margin-top: 25px;
    font-size: 0.9em;
    color: #777;
}

/* === 11. FOOTER STYLING === */
.main-footer {
    background-color: var(--primary-dark); /* สีน้ำเงินเข้ม */
    color: #ccc;
    padding-top: 50px;
}

.footer-top {
    padding-bottom: 40px;
    border-bottom: 1px solid #3a4a6b; /* สีเทาอ่อนกว่าพื้นหลัง */
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-col h4 {
    color: white; /* เปลี่ยนเป็นสีขาว */
    margin-bottom: 20px;
    font-size: 1.1em;
    position: relative;
}
.footer-col h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 40px;
    height: 2px;
    background-color: var(--accent-teal);
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li{
    margin-bottom: 8px;
}

/* Quick Links & Support links (including Business/Privacy Policy) use the same .footer-col a style below */
.footer-col a {
    color: #cccccc; /* เปลี่ยนเป็นสีเทาอ่อนที่สว่างกว่าเดิม */
    transition: color 0.3s;
}

.footer-col a:hover {
    color: white; /* เปลี่ยนเป็นสีขาวเมื่อ Hover */
}

.footer-logo p {
    margin-top: 10px;
    font-size: 0.9em;
    color: #a0a0a0;
    margin-bottom: 8px;
}

/* Social Links */
.social-links {
    display: inline-flex;
    margin-top: 15px;
    gap: 12px;
}
.social-icon {
    justify-content: center;
    align-items: center;
    width: 33px;
    height: 33px;
    padding: 6px;
    border-radius: 50%;
    background-color: #3a4a6b; /* สีเทา/น้ำเงินอ่อน */
    transition: background-color 0.3s;
    border: none; /* ลบ border หากมี */
}

.social-icon img {
    width: 20px;
    height: 20px;
    /* ถ้า icon เป็นสีขาว/ฟ้าอยู่แล้ว ไม่ต้องปรับฟิลเตอร์ */
}

.social-icon:hover {
    background-color: var(--accent-teal);
    color: white;
}

.contact-info p{
    margin-bottom: 4px;
}

/* Footer Bottom */
.footer-bottom {
    text-align: center;
    padding: 15px 0;
    font-size: 0.85em;
    color: #777;
}
.footer-bottom a {
    color: #777;
}


/* === 12. POLICY PAGES STYLING === */
.policy-page-container {
    padding: 50px 0;
    max-width: 900px; /* จำกัดความกว้างเนื้อหา */
}

.policy-section {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.policy-section h2 {
    color: var(--primary-dark);
    font-size: 1.5em;
    margin-bottom: 10px;
}

.policy-section p {
    line-height: 1.7;
    color: #444;
}

/* === 13. PAYMENT FORM STYLING === */
.payment-page-container {
    padding: 40px 0;
}

.payment-layout {
    display: flex;
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Summary Box (Left) */
.payment-summary-box {
    flex: 0 0 350px;
    background-color: #f9f9f9;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: fit-content;
}

.payment-summary-box h4 {
    color: var(--primary-dark);
    margin-bottom: 15px;
}

.final-total-large {
    font-size: 1.8em;
    color: var(--accent-teal);
    margin-top: 15px;
    font-weight: bold;
}

/* Payment Form Section (Right) */
.payment-form-section {
    flex-grow: 1;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.omise-loading-note {
    background-color: #fff3cd;
    color: #856404;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.payload-debug {
    background: #eee;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 0.85em;
    overflow-x: auto;
}

.payment-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.security-note {
    font-size: 0.8em;
    text-align: center;
    margin-top: 15px;
    color: #777;
}

/* === 14. PAYMENT FORM PAGE STYLING (Refinement based on image) === */

.payment-page-container {
    padding: 50px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.payment-layout {
    display: flex;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Left Side: Order Summary Box */
.payment-summary-box {
    flex: 0 0 350px; /* กำหนดความกว้างคงที่ */
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    height: fit-content;
}

.payment-summary-box h4 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}
.payment-summary-box p {
    margin-bottom: 8px;
    font-size: 0.95em;
}

.final-total-large {
    font-size: 2em;
    color: var(--accent-teal);
    font-weight: bold;
    margin-top: 15px;
}
.final-total-large strong {
    font-size: 1.2em;
}

.note-small {
    font-size: 0.8em;
    color: #777;
    margin-top: 5px;
}

/* Right Side: Payment Interface */
.payment-form-section {
    flex-grow: 1;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.omise-loading-note {
    background-color: #fff3cd; /* สีเหลืองอ่อน */
    color: #856404; /* สีข้อความ */
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 25px;
}

.payload-debug {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 25px;
    font-size: 0.85em;
    white-space: pre-wrap; /* ช่วยให้ JSON แสดงผลได้ดีขึ้น */
}
.payload-debug h4 {
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.payment-form input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.security-note {
    font-size: 0.8em;
    text-align: center;
    margin-top: 15px;
    color: #777;
}

/* Responsive Adjustment */
@media (max-width: 992px) {
    .payment-layout {
        flex-direction: column;
    }
    .payment-summary-box {
        order: -1; /* ให้ Summary อยู่บนสุด */
    }
}

/* === 15. INPUT FIELD STYLING (Refined) === */
.payment-form-section h4 {
    color: var(--primary-dark);
    margin-bottom: 20px;
    font-size: 1.2em;
}

.payment-form input {
    /* ปรับสไตล์ input ให้ดูดีขึ้น */
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid #ccc; /* เส้นขอบสีเทาอ่อน */
    border-radius: 6px; /* ขอบมนขึ้นเล็กน้อย */
    font-size: 1em;
    transition: border-color 0.3s;
}

.payment-form input:focus:not(:disabled) {
    border-color: var(--accent-teal); /* ไฮไลท์เมื่อ Focus */
    outline: none;
}

.payment-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9em;
}


/* --- 1. Detail Section (Left Side) --- */
.detail-section {
    flex-grow: 1; /* ให้ส่วนนี้กินพื้นที่ส่วนใหญ่ */
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.service-image-large {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

.detail-section h4 {
    color: var(--primary-dark);
    border-bottom: 2px solid var(--accent-teal);
    padding-bottom: 5px;
    margin-top: 20px;
    margin-bottom: 15px;
}

.booking-form input[type="text"],
.booking-form input[type="email"],
.booking-form input[type="date"],
.booking-form select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.customer-details {
    padding: 15px;
    border: 1px dashed #ccc;
    border-radius: 5px;
    margin-top: 20px;
}
.customer-details h4 {
    border-bottom: none;
}

.summary-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

.summary-footer p {
    margin-bottom: 5px;
    font-size: 1.1em;
}

.proceed-to-pay {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    margin-top: 15px;
}

/* --- 2. Summary Box (Right Side) --- */
.summary-box {
    flex: 0 0 300px; /* กำหนดความกว้างคงที่ */
    background-color: var(--light-bg);
    padding: 25px;
    border-radius: 10px;
    height: fit-content;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.summary-box h4 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.summary-box p {
    margin-bottom: 8px;
}

.final-total {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--accent-teal);
    margin-top: 15px;
}

/* Mobile adjustments for Booking Page */
@media (max-width: 992px) {
    .booking-layout {
        flex-direction: column;
    }
    .summary-box {
        order: -1; /* ให้ Summary Box มาอยู่ด้านบนสุดบนมือถือ */
    }
}

@media (max-width: 768px) {
    /* Navigation Bar (Mobile View) */
    .main-nav {
        display: none; /* ซ่อนเมนูหลัก */
        flex-direction: column;
        position: absolute;
        top: 100%; /* อยู่ใต้ Header */
        left: 0;
        width: 100%;
        background-color: white;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
        padding: 15px 0;
    }
    
    .main-nav.active { /* คลาสนี้จะถูกเพิ่ม/ลบด้วย JavaScript */
        display: flex;
    }
    
    .main-nav a {
        margin: 5px 20px;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }
    
    .main-nav a.cta-button {
        border-radius: 0;
    }

    .menu-toggle {
        display: block; /* แสดงปุ่มแฮมเบอร์เกอร์ */
        font-size: 1.5em;
        cursor: pointer;
    }
    
    /* Category List */
    .category-list {
        flex-wrap: wrap;
        justify-content: space-around; /* จัดกึ่งกลางเมื่อรายการน้อยกว่า 4 */
    }
    .category-item {
        flex-basis: 45%; /* แสดง 2 คอลัมน์ (45% x 2 = 90%, เหลือช่องว่าง) */
        margin-bottom: 30px;
    }
    
    /* Service Grid */
    .service-grid {
        grid-template-columns: 1fr; /* แสดง 1 คอลัมน์ */
    }
    
    .testimonial-section, .featured-categories, .featured-services {
        padding: 40px 0;
    }

    .main-content-area {
        flex-direction: column;
    }
    .filter-sidebar {
        flex: 1 1 auto;
        width: 100%;
        box-shadow: none; /* ลดเงา Sidebar บนมือถือ */
        border-bottom: 1px solid #eee;
        padding: 10px 0;
    }
    .results-list {
        /* ให้ผลการค้นหาเรียงเป็น 1 คอลัมน์ */
    }
}