/* =========================================================
   Sivalai.com Base Styles & Custom Variables
   ========================================================= */

:root {
    --primary-color: #0d6efd; /* Blue */
    --secondary-color: #6c757d; /* Gray */
    --success-color: #198754; /* Green */
    --danger-color: #dc3545; /* Red (For Price/Alerts) */
    --font-family: 'Sarabun', sans-serif; 
}

body {
    font-family: var(--font-family);
    background-color: #f4f6f9; /* Light background for contrast */
    line-height: 1.6;
}

/* =========================================================
   1. Typography & General UI
   ========================================================= */

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

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

a:hover {
    color: #0a58ca;
}

/* Enhancing accessibility (Requirement NFR 6.3.2) */
.btn:focus,
.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* =========================================================
   2. Homepage Hero Section (home.php)
   ========================================================= */

.homepage-hero {
    /* Background Image is set inline in home.php, but CSS handles overlay and height */
    overflow: hidden;
}

.hero-image {
    min-height: 450px;
    height: auto;
    padding: 30px;
}

/* Search bar styling */
#main-keyword-search {
    flex-grow: 1;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
}

#search-suggestions {
    position: absolute;
    width: calc(100% - 100px); /* Adjust width relative to search container */
    max-width: 600px;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    left: 50%;
    transform: translateX(-50%);
    margin-top: 5px;
}

/* =========================================================
   3. Listing Cards & Results (search.php)
   ========================================================= */

.listing-card {
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.listing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.listing-card img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

/* Mobile adjustments for listing cards */
@media (max-width: 767.98px) {
    .listing-card .row {
        flex-direction: column;
    }
    .listing-card img {
        height: 180px; /* Fix height for mobile image */
        border-radius: 8px 8px 0 0;
    }
}


/* =========================================================
   4. Sidebar and Map (search.php)
   ========================================================= */

.sticky-top {
    /* Ensures the sidebar filters stay in view on desktop */
    top: 20px;
}

#search-map {
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* =========================================================
   5. PDPA & Utility Components
   ========================================================= */

/* Cookie Banner (fixed-bottom) */
#cookie-banner {
    z-index: 1050; /* Ensure it is above other elements */
    opacity: 0.95;
    border-top: 3px solid var(--success-color);
}

/* Image Preview in Create Listing Form */
.img-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* =========================================================
   6. Media Queries for Responsiveness (Mobile-First)
   ========================================================= */

/* Tablets (md: 768px and up) */
@media (min-width: 768px) {
    .hero-image {
        padding: 50px;
        min-height: 500px;
    }
}

/* Desktop (lg: 992px and up) */
@media (min-width: 992px) {
    .listing-card img {
        height: 180px; /* Adjusted height for desktop row layout */
    }
    .hero-image {
        min-height: 550px;
    }
}