﻿/*
 * Dosaledoo.com - Main Stylesheet
 * Version: 1.0
 */

/* --- 1. Global Styles & Variables --- */
:root {
    --primary-color: #007bff; /* สีฟ้าหลัก */
    --secondary-color: #6c757d; /* สีเทา */
    --warning-color: #ffc107; /* สีเหลือง */
    --success-color: #28a745; /* สีเขียว */
    --danger-color: #dc3545; /* สีแดง */
    --light-color: #f8f9fa; /* สีพื้นหลังอ่อน */
    --dark-color: #343a40; /* สีตัวอักษรเข้ม */
    --body-font: 'Sarabun', sans-serif;
    --container-width: 1140px;
}

body {
    font-family: var(--body-font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark-color);
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

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

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
}

.page-container {
    padding-top: 2rem;
    padding-bottom: 2rem;
    background-color: #ffffff;
    min-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-top: 2rem;
    margin-bottom: 2rem;
}

img {
    max-width: 100%;
    height: auto;
}

hr {
    border: 0;
    border-top: 1px solid #dee2e6;
    margin: 1rem 0;
}

/* --- 2. Header & Navigation --- */
.site-header {
    background-color: #ffffff;
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}
.logo:hover {
    text-decoration: none;
}
.logo .logo-blue {
    color: var(--primary-color);
}
.logo .logo-yellow {
    color: var(--warning-color);
}

.nav-desktop ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
}

.nav-desktop li {
    margin-left: 20px;
}

.nav-desktop a {
    text-decoration: none;
    font-weight: 700;
    color: var(--dark-color);
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
}
.nav-desktop a:hover, .nav-desktop a.active {
    background-color: var(--light-color);
}
.nav-desktop .btn-login:hover {
    background-color: #e0a800;
}

/* Dropdown Menu */
.dropdown {
    position: relative; /* เป็นจุดอ้างอิงให้เมนูย่อย */
}

.dropdown-menu {
    display: none; /* ซ่อนไว้ปกติ */
    position: absolute; /* ทำให้ลอยออกมาจาก flow ปกติ */
    top: 120%; /* ระยะห่างจากเมนูด้านบน */
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px; /* เพิ่มความโค้งมน */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    list-style: none;
    padding: 10px 0;
    margin: 0;
    width: 240px; /* กำหนดความกว้างที่แน่นอน */
    z-index: 1001;
    opacity: 0; /* สำหรับทำ animation */
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

/* เมื่อชี้ที่ .dropdown ให้ .dropdown-menu แสดงผล */
.dropdown:hover .dropdown-menu {
    display: block; /* ทำให้มองเห็น */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
    width: 100%; /* ทำให้ li เต็มความกว้างของเมนู */
}

.dropdown-menu a {
    display: flex; /* ใช้ flexbox จัดไอคอนและข้อความ */
    align-items: center;
    padding: 10px 20px;
    font-weight: 400;
    color: var(--dark-color);
    white-space: nowrap; /* ไม่ให้ข้อความตกบรรทัด */
}
.dropdown-menu a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    color: var(--secondary-color);
}
.dropdown-menu a:hover {
    background-color: var(--light-color);
    text-decoration: none;
    color: var(--primary-color);
}

.dropdown-menu .dropdown-divider {
    height: 1px;
    margin: 0.5rem 0;
    overflow: hidden;
    background-color: #e9ecef;
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-color);
}

.nav-mobile {
    display: none;
    flex-direction: column;
    background-color: #fff;
    border-top: 1px solid #ddd;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.nav-mobile.active {
    display: flex;
}

.nav-mobile ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-mobile li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--dark-color);
    border-bottom: 1px solid #eee;
    font-weight: 700;
}
.nav-mobile li a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

.nav-mobile-user {
    padding: 15px 20px;
    background-color: var(--light-color);
    font-weight: bold;
    color: var(--primary-color);
}


/* --- 3. Footer --- */
.site-footer {
    background-color: var(--dark-color);
    color: #ccc;
    padding: 3rem 0;
    font-size: 0.9rem;
}

.footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
}

.footer-column {
    flex: 1;
    min-width: 250px;
}

.footer-column h4 {
    color: #fff;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.footer-column ul {
    list-style: none;
    padding: 0;
}

.footer-column li {
    margin-bottom: 0.5rem;
}

.footer-column a {
    color: #ccc;
    text-decoration: none;
}
.footer-column a:hover {
    color: #fff;
    text-decoration: none;
}
.footer-column p i {
    margin-right: 10px;
}


.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #444;
}

/* --- 4. Forms & Buttons --- */
.form-styled .form-group {
    margin-bottom: 1.5rem;
}
.form-styled label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.form-styled input[type="text"],
.form-styled input[type="email"],
.form-styled input[type="password"],
.form-styled input[type="number"],
.form-styled input[type="tel"],
.form-styled select,
.form-styled textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    font-family: var(--body-font);
    box-sizing: border-box;
}
.form-styled input:focus, .form-styled select:focus, .form-styled textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
}

.btn, button {
    display: inline-block;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border-radius: 5px;
    border: none;
    transition: all 0.3s ease;
}
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: #0056b3;
    color: #fff;
    text-decoration: none;
}
.btn-login {
    background-color: var(--warning-color);
    color: var(--dark-color);
}
.btn-login:hover {
    background-color: #e0a800;
    color: var(--dark-color);
    text-decoration: none;
}
.btn-lg {
    padding: 15px 30px;
    font-size: 1.2rem;
}
.btn-block {
    display: block;
    width: 100%;
}
/* เพิ่มสไตล์สำหรับ Password Toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper .toggle-password {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: #aaa;
}

.password-wrapper .toggle-password:hover {
    color: var(--dark-color);
}

/* จัดกึ่งกลางฟอร์ม Login/Register */
.auth-form-container {
    max-width: 450px;
    margin: 2rem auto;
    padding: 2rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #fff;
}
/* --- 5. Alerts --- */
.alert {
    padding: 15px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 5px;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

/* --- 6. Helper & Floating Buttons --- */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--dark-color);
    color: #fff;
    width: 50px;
    height: 50px;
    text-align: center;
    line-height: 50px;
    border-radius: 50%;
    /* --- การจัดวางไอคอนให้อยู่กึ่งกลาง (ใช้ Flexbox) --- */
    display: flex;
    justify-content: center;
    align-items: center;
    /* --- ดีไซน์ของปุ่ม --- */
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 998;
}
#back-to-top:hover {
    background-color: var(--primary-color);
    text-decoration: none;
    color: #fff;
}
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 998;
}
.fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: none; /*2px 2px 8px rgba(0,0,0,0.2);*/
    transition: transform 0.2s;
}
.fab:hover {
    transform: scale(1.1);
    color: #fff;
    text-decoration: none;
}
.fab-phone { background-color: #007bff; }
.fab-line { background-color: #06C755; }
.fab-facebook { background-color: #1877F2; }
.fab-whatsapp { background-color: #25D366; } 

/* --- 7. Property Detail Page --- */

.property-detail-page h1,
.property-detail-page h3 {
    margin-top: 0;
}

.property-code {
    font-size: 1rem;
    font-weight: 500;
    color: var(--secondary-color);
    background-color: #f0f0f0; /* สีพื้นหลังอ่อนๆ */
    padding: 5px 12px;
    border-radius: 5px;
    display: inline-block;
    margin-bottom: 1rem;
}

.property-features {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.property-features span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.property-description {
    line-height: 1.8; /* เพิ่มระยะห่างบรรทัดให้อ่านง่าย */
}

.property-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2rem;
}

.property-main-content {
    flex: 3;
    min-width: 300px;
}

.property-sidebar {
    flex: 1;
    min-width: 280px;
}

/* === Action Box Styles (Updated) === */
.action-box {
    background-color: var(--light-color);
    /*padding: 1.5rem;*/
    border-radius: 8px; /* เพิ่มความโค้งมน */
    border: 1px solid #ddd;
    position: sticky;
    top: 100px; /* Offset for sticky header */
	 overflow: hidden; /* เพิ่มตัวนี้เข้าไปเพื่อความสวยงามของ border-radius */
}

/* กล่องแสดงราคา */
.action-box .price-box {
    margin-bottom: 1rem;
    text-align: center;
}

.price-box .price-item {
    margin-bottom: 1rem;
}

.price-box .price-item:last-child {
    margin-bottom: 0;
}

.price-box .price-label {
    display: block;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.price-box .price-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.price-box .price-value small {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--secondary-color);
}
/* สิ้นสุดส่วนกล่องราคา */

.action-box .agent-info {
    text-align: center;
    margin-top: 1rem;
}
/* --- 8. Responsive Design --- */
@media (max-width: 992px) {
    .header-container {
        padding: 0 20px;
    }
}

@media (max-width: 768px) {
    .nav-desktop {
        display: none;
    }
    .mobile-menu-toggle {
        display: block;
    }
    
    .footer-container {
        flex-direction: column;
    }
    
    .property-layout {
        flex-direction: column;
    }
    
    .action-box {
        position: static; /* Un-stick the sidebar on mobile */
    }

    .page-container {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
}
/* ลืมรหัสผ่าน */
.d-flex {
    display: flex;
}
.justify-content-between {
    justify-content: space-between;
}
.forgot-password-link {
    font-size: 0.9rem;
    font-weight: normal;
}
.text-center {
    text-align: center;
}
.mt-3 {
    margin-top: 1rem;
}

/* --- 9. Property Gallery & Lightbox (REVISED) --- */
.property-gallery {
    margin-bottom: 2rem;
}

/* === Desktop First: Grid Layout (สำหรับจอใหญ่) === */
.gallery-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto;
    gap: 8px;
    max-height: 500px;
    overflow: hidden; /* << เพิ่มบรรทัดนี้เข้าไป */
    border-radius: 8px; /* << ย้าย border-radius มาไว้ที่นี่ด้วยจะดีมาก */
}

.gallery-grid a {
    display: block;
    overflow: hidden;
    border-radius: 8px; /* ย้าย border-radius มาที่ 'a' เพื่อครอบคลุมทั้งหมด */
    position: relative;
    height: 100%;
}

.gallery-grid a:hover::after { /* เพิ่ม overlay effect สวยงาม */
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.1);
}

.gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ทำให้รูปเต็มกรอบโดยไม่เสียสัดส่วน */
    display: block; /* แก้ปัญหาช่องว่างเล็กๆ ใต้รูป */
}

.main-image {
    grid-row: 1 / 3; /* ให้รูปหลักกิน 2 แถวของ grid */
}

.sub-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
}

#view-all-photos {
    margin-top: 1rem;
    width: 100%; /* ทำให้ปุ่มเต็มความกว้าง */
}

/* === Mobile Responsive: Flex Layout (สำหรับจอเล็ก) === */
@media (max-width: 768px) {
    .gallery-grid {
        display: flex;         /* << เปลี่ยนเป็น Flexbox */
        flex-direction: column;  /* << เรียงจากบนลงล่าง */
        max-height: none;        /* << ไม่จำกัดความสูง */
        gap: 10px;               /* << ปรับระยะห่าง */
    }

    .main-image {
        /* ไม่ต้องกำหนดอะไรเพิ่ม เพราะ flex-direction: column จะทำให้มันเต็มความกว้างเอง */
        aspect-ratio: 16 / 10; /* กำหนดสัดส่วนให้สวยงามบนมือถือ */
    }

    .sub-images {
        display: flex;        /* << เปลี่ยนเป็น Flexbox */
        flex-direction: row;  /* << เรียงรูปย่อยแนวนอน */
        overflow-x: auto;     /* << สำคัญ! ทำให้เลื่อนแนวนอนได้ */
        overflow-y: hidden;
        gap: 10px;
        padding-bottom: 5px; /* เพิ่มพื้นที่เล็กน้อยให้ scrollbar */

        /* ซ่อน scrollbar ให้สวยงาม (Optional but recommended) */
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }
    .sub-images::-webkit-scrollbar {
        display: none; /* Chrome, Safari, and Opera */
    }

    /* กำหนดขนาดของ thumbnail ใน .sub-images */
    .sub-images a {
        flex-shrink: 0;  /* << สำคัญ! ป้องกันไม่ให้รูปถูกบีบ */
        width: 120px;    /* ความกว้างของ thumbnail */
        height: 80px;    /* ความสูงของ thumbnail */
    }
}

/* --- Lightbox Styles (คงเดิม) --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1100;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}
.lightbox-close:hover {
    color: #bbb;
}

.lightbox-prev, .lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
}
.lightbox-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}
.lightbox-prev:hover, .lightbox-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* --- 10. Homepage Hero & Main Search --- */
.homepage-hero {
    background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://images.unsplash.com/photo-1560448204-e02f11c3d0e2'); /* รูปพื้นหลังตัวอย่าง */
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 6rem 1rem;
    text-align: center;
}
.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}
.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}
.main-search-bar {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 8px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.search-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}
.field-group {
    flex: 1;
    text-align: left;
    color: var(--dark-color);
}
.field-group.keyword-field {
    flex: 2; /* ให้ช่อง keyword กว้างกว่าช่องอื่น */
}
.field-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.field-group select, .field-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}
.field-group.button-group {
    flex: 0 0 auto; /* ไม่ให้ปุ่มยืด */
}
.field-group button {
    width: 100%;
    height: 48px; /* ทำให้สูงเท่า input */
}

/* --- 11. Search Results & Property Card --- */

.search-results-grid {
    display: grid;
    /* สร้างคอลัมน์ให้ยืดหยุ่น โดยมีความกว้างอย่างน้อย 300px */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.property-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; /* ใช้ flexbox เพื่อให้ a ยืดเต็มความสูงของการ์ด */
    flex-direction: column;
}

.property-card:hover .card-image img {
    transform: scale(1.05); /* ทำให้รูปซูมเข้าเล็กน้อย */
}

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

.property-card a {
    text-decoration: none;
    color: var(--dark-color);
    display: flex;
    flex-direction: column;
    height: 100%; /* ทำให้ a ยืดเต็ม */
}

.card-image {
    position: relative;
    display: block; /* ทำให้เป็น block-level element */
    width: 100%;
    aspect-ratio: 16 / 10; 
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
	width: 100%;
    height: 100%;
    object-fit: cover; /* ทำให้รูปเต็มกรอบโดยไม่เสียสัดส่วน */
	transition: transform 0.4s ease;
}

.card-listing-type {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--primary-color);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 2;
}

.card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* ทำให้ content ยืดเพื่อดันราคาไปอยู่ล่างสุด */
}

.card-title {
    font-size: 1.1rem;
    margin: 0 0 0.25rem 0;
    /* ทำให้ข้อความที่ยาวเกินไปแสดง ... */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
}

.card-property-code {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--secondary-color);
    margin: 0 0 0.75rem 0;
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.card-address {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin: 0 0 1rem 0;
    flex-grow: 1; /* ดันราคาลงไปอยู่ล่างสุด */
}

.card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
    margin-bottom: 0.75rem; /* หรือ 1rem ตามความสวยงามที่ต้องการ */
}

.card-price {
    font-weight: 700;
    margin-top: auto; /* ทำให้ราคาอยู่ล่างสุดเสมอ */
}

.card-price p {
    margin: 0;
    line-height: 1.3;
}

.price-sale {
    font-size: 1.3rem;
    color: var(--primary-color);
}

.price-rent {
    font-size: 1rem;
    color: var(--secondary-color);
}

.price-rent span {
    font-size: 0.85rem;
    font-weight: 400;
}

/* --- 12. Homepage Sections --- */

.page-section {
    padding: 3rem 15px;
}

.section-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 2.5rem;
    font-size: 2.2rem;
    font-weight: 700;
}

.view-all-button-container {
    text-align: center;
    margin-top: 2.5rem;
}
/* --- 13. Promoted Listings & Packages --- */

/* ทำให้การ์ดที่โปรโมทมีกรอบสีพิเศษ */
.property-card.promoted {
    border: 2px solid var(--warning-color);
    box-shadow: 0 5px 20px rgba(255, 193, 7, 0.3);
}

/* ป้าย "ประกาศแนะนำ" */
.promoted-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--warning-color);
    color: var(--dark-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
}
/* ย้ายป้าย ขาย/เช่า มาด้านซ้ายแทน */
.card-listing-type {
    left: 10px;
    right: auto;
}

/* สไตล์สำหรับหน้าเลือกแพ็คเกจโปรโมท */
.promote-packages {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}
.package-item {
    flex: 1;
}
.package-item input[type="radio"] {
    display: none; /* ซ่อน radio button จริง */
}
.package-item label {
    display: block;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}
.package-item label .duration {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
}
.package-item label .price {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.5rem;
}
.package-item input[type="radio"]:checked + label {
    border-color: var(--primary-color);
    background-color: #eaf4ff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.2);
}
/* --- 14. Agent Profile & Reviews --- */

.agent-profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background-color: var(--light-color);
    border-radius: 8px;
    margin-bottom: 2rem;
}
.agent-avatar {
    flex-shrink: 0;
}
.agent-profile-header h1 {
    margin: 0 0 0.5rem 0;
}
.agent-profile-header p {
    margin: 0;
    color: var(--secondary-color);
}
.agent-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    margin-top: 1rem;
}

/* Star Rating System */
.stars {
    --percent: calc(var(--rating) / 5 * 100%);
    display: inline-block;
    font-size: 1.5rem;
    font-family: Times; /* or any other font that supports ★ */
    line-height: 1;
    color: #ccc;
}
.stars::before {
    content: '★★★★★';
    letter-spacing: 3px;
    background: linear-gradient(90deg, var(--warning-color) var(--percent), #ccc var(--percent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.review-header .stars { font-size: 1rem; }

.agent-profile-body {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}
.agent-main-content {
    flex: 3;
    min-width: 300px;
}
.agent-sidebar {
    flex: 1;
    min-width: 280px;
}
.agent-sidebar .contact-box {
    background-color: #fff;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    position: sticky;
    top: 100px;
}
.contact-box h4 { margin-top: 0; }
.contact-box .note {
    font-size: 0.85rem;
    color: var(--danger-color);
    margin-top: 1rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.reviews-list .review-item {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}
.reviews-list .review-item:last-child {
    border-bottom: none;
}
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.review-comment {
    margin: 0 0 0.5rem 0;
}
.review-date {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* --- 15. Star Rating Input --- */
.star-rating-input {
    display: flex;
    flex-direction: row-reverse; /* ทำให้ดาวเรียงจากขวาไปซ้าย */
    justify-content: flex-end;
}
.star-rating-input input[type="radio"] {
    display: none;
}
.star-rating-input label {
    font-size: 2.5rem;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0 0.1em;
}

/* เมื่อเอาเมาส์ไปชี้ดาว และดาวที่อยู่ก่อนหน้ามัน (ทางขวา) จะเปลี่ยนสี */
.star-rating-input:not(:checked) > label:hover,
.star-rating-input:not(:checked) > label:hover ~ label {
    color: #ffc107;
}

/* ดาวที่ถูกเลือก และดาวที่อยู่ก่อนหน้ามัน จะเป็นสีทอง */
.star-rating-input > input:checked ~ label {
    color: #ffc107;
}
/* --- 16. Related Properties Section --- */

.related-properties-section {
    background-color: var(--light-color); /* สีพื้นหลังอ่อนๆ */
    padding: 3rem 0;
    border-top: 1px solid #ddd;
}
/* ============================================= */
/*  17. Professional Contact Form (Sidebar)      */
/* ============================================= */

.action-box h4 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.action-box .form-intro {
    text-align: center;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.contact-form-styled .form-group,
.contact-form-styled .form-group-with-icon {
    margin-bottom: 1rem;
    position: relative;
}

/* สไตล์สำหรับ Input และ Textarea ในฟอร์มนี้โดยเฉพาะ */
.contact-form-styled input[type="text"],
.contact-form-styled input[type="email"],
.contact-form-styled input[type="tel"],
.contact-form-styled textarea {
    width: 100%;
    border: 1px solid #dcdcdc;
    background-color: #fff;
    border-radius: 8px; /* ทำให้โค้งมนมากขึ้น */
    padding: 12px 15px;
    font-size: 1rem;
    font-family: var(--body-font);
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

/* สไตล์สำหรับ Input ที่มีไอคอน */
.contact-form-styled .form-group-with-icon input {
    padding-left: 45px; /* เพิ่ม padding ด้านซ้ายเพื่อเว้นที่ให้ไอคอน */
}

.contact-form-styled .form-group-with-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #ababab; /* สีไอคอนเทาอ่อน */
    font-size: 1.1rem;
    transition: color 0.3s;
}

/* เมื่อผู้ใช้กำลังพิมพ์ในช่อง Input */
.contact-form-styled input:focus,
.contact-form-styled textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* เมื่อผู้ใช้กำลังพิมพ์ในช่องที่มีไอคอน ให้ไอคอนเปลี่ยนสี */
.contact-form-styled .form-group-with-icon input:focus + i,
.contact-form-styled .form-group-with-icon:focus-within i {
    color: var(--primary-color);
}

.contact-form-styled textarea {
    padding: 15px;
}

/* สไตล์ปุ่มส่งข้อมูล */
.contact-form-styled .btn-submit-lead {
    padding: 14px 25px;
    font-size: 1.1rem;
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.contact-form-styled .btn-submit-lead:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

/* สไตล์ปุ่มโทรศัพท์สำรอง */
.action-box .agent-info {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.action-box .agent-info p {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
}

.action-box .agent-info .btn-secondary {
    background-color: #6c757d;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.action-box .agent-info .btn-secondary:hover {
    background-color: var(--dark-color);
    color: white;
    text-decoration: none;
}
/* ========================================================= */
/* --- 18. Mobile Responsive Overrides (ส่วนที่เพิ่มเข้ามา) --- */
/* ========================================================= */

@media (max-width: 768px) {

    /* --- ปรับปรุง Hero Banner ให้ข้อความไม่ใหญ่เกินไปบนมือถือ --- */
    .hero-content h1 {
        font-size: 2.2rem; /* ลดขนาด H1 */
    }
    .hero-content p {
        font-size: 1rem; /* ลดขนาด P */
    }
    .homepage-hero {
        padding: 4rem 1rem; /* ลดระยะห่างบน-ล่าง */
    }

    /* --- ปรับปรุง Main Search Bar บนหน้าแรกสำหรับมือถือ (ส่วนสำคัญ) --- */
    .main-search-bar .search-fields {
        flex-direction: column; /* << หัวใจหลัก: เปลี่ยนเป็นเรียงแนวตั้ง */
        align-items: stretch;   /* ทำให้ทุก field กว้างเท่ากัน */
        gap: 1rem;              /* ปรับระยะห่างให้เหมาะสม */
    }

    /* ไม่จำเป็นต้องกำหนด flex-grow ให้ต่างกันแล้วในแนวตั้ง */
    .main-search-bar .field-group,
    .main-search-bar .field-group.keyword-field,
    .main-search-bar .field-group.button-group {
        flex: 1 1 100%;
    }

    .main-search-bar .field-group button {
        height: 50px; /* ทำให้ปุ่มสูงขึ้นเล็กน้อย ดูดีบนมือถือ */
        font-size: 1.1rem;
    }
}
