/* assets/css/style.css */
:root {
    --primary-color: #0059A1;
    /* Blu Oceano */
    --accent-color: #F18825;
    /* Arancione Zucca */
    --secondary-blue: #70C4EF;
    /* Azzurro Maya */
    --light-blue: #99D9F9;
    /* Azzurro Cielo */

    --text-main: #222222;
    /* Basic Text */
    --bg-color: #FFFFFF;
    --secondary-bg: #F7F7F7;
    --border-color: #DDDDDD;
    --shadow-soft: 0 6px 16px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.2);
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-card: 12px;
    --radius-btn: 8px;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Bootstrap Overrides for Branding */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #d1701b;
    /* Darker Orange */
    border-color: #d1701b;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Layout Refactoring for Body Scroll & Sticky Map */
.app-container {
    display: flex;
    flex-wrap: wrap;
    min-height: calc(100vh - 76px);
    width: 100%;
    position: relative;
}

.property-sidebar {
    width: 840px;
    max-width: 55%;
    background: white;
    display: flex;
    flex-direction: column;
    z-index: 10;
    min-height: 100vh;
    /* Ensure full height */
    position: relative;
    /* Removed fixed & overflow-y to allow body scroll */
}

.map-container {
    flex-grow: 1;
    width: calc(100% - 840px);
    /* Fill remaining space */
    position: sticky;
    /* Sticky map */
    top: 76px;
    /* Below navbar */
    height: calc(100vh - 76px);
    background: #e5e5e5;
    z-index: 5;
}

#map {
    height: 100%;
    width: 100%;
}

/* Sidebar Header */
.sidebar-header {
    padding: 32px 40px 24px 40px;
    /* Much larger padding to detach from edges */
    border-bottom: 1px solid var(--border-color);
    background: white;
    z-index: 10;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    /* Bolder logo */
    color: var(--primary-color);
    margin-bottom: 0;
    /* Align with flex center */
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Filters */
/* Filters */
/* Filters V3: 3 Columns for 2 distinct rows */
.filters {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    /* 3 Equal columns */
    gap: 24px;
    /* More breathing room */
    padding: 20px 0 0 0;
    /* Remove top padding as header has enough, keep structure */
    width: 100%;
    align-items: end;
}

/* Specific behaviors */
.filters .filter-item {
    width: 100%;
}

/* Price Slider Container */
.filters .price-filter {
    grid-column: span 1;
    /* Occupy 1 column in middle of top row */
    margin: 0;
    padding: 0;
    border: none;
}

/* Checkbox Container */
.filters .checkbox-filter {
    display: flex;
    align-items: center;
    height: 100%;
    padding-bottom: 12px;
    /* Align with inputs */
}

/* Mobile responsive adjustments */
@media (max-width: 900px) {
    .filters {
        grid-template-columns: 1fr;
        /* Stack on mobile */
        gap: 12px;
    }
}

/* Header Contact Box Styles */
.contact-box {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: var(--radius-btn);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.contact-box.phone {
    background-color: var(--primary-color);
    margin-right: 8px;
}

.contact-box.email {
    background-color: var(--accent-color);
}

.contact-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    color: white;
    /* Ensure text remains white */
}

.contact-box i {
    font-size: 16px;
    margin-right: 8px;
}

/* Airbnb-style Pill Buttons for Filters */
.form-select,
.price-filter-container {
    padding: 10px 16px;
    border-radius: 30px !important;
    /* Pill shape */
    border: 1px solid var(--border-color);
    background-color: white;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    /* Custom dropdown arrow if we wanted, for now native is okay but styled */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.form-select:hover {
    border-color: var(--primary-color);
}

.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.price-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.price-display {
    font-weight: 600;
    font-size: 14px;
    min-width: 80px;
}

input[type=range] {
    accent-color: var(--primary-color);
    width: 100%;
    cursor: pointer;
}

/* Property List */
.property-list-container {
    flex-grow: 1;
    /* overflow-y: auto; REMOVED to let parent scroll */
    padding: 24px;
    background: white;
}

/* ... existing code ... */

/* Responsive Layout */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }

    .property-sidebar {
        width: 100%;
        max-width: 100%;
        min-height: auto;
        box-shadow: none;
    }

    .map-container {
        display: none;
        /* Hide map on mobile as per requirement */
    }

    .sidebar-header {
        padding: 24px;
        position: relative;
        top: 0;
        z-index: 1;
        box-shadow: none;
    }

    .property-list-container {
        padding: 24px;
    }

    /* Force card image visibility on mobile */
    .card-image {
        min-height: 250px;
        height: auto;
        aspect-ratio: 16/9;
    }
}

/* Grid for cards */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.property-card {
    background: white;
    border-radius: var(--radius-card);
    transition: transform 0.2s;
    cursor: pointer;
    border: none;
    display: flex;
    flex-direction: column;
    /* For hover effects handled via child selectors */
}

/* Modal Stylings */
.modal-content {
    border-radius: 24px;
    /* More rounded like Airbnb */
    overflow: hidden;
}

.modal-image-container img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.modal-header {
    border-bottom: none;
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 10px;
    background-size: 10px;
}

/* No shadow by default similar to new airbnb, specific hover state */
.property-card:hover .card-image {
    filter: brightness(1.02);
}

.card-image {
    height: 260px;
    /* Taller images */
    width: 100%;
    background-color: #f0f0f0;
    background-size: cover;
    background-position: center;
    position: relative;
    border-radius: var(--radius-card);
    /* Rounded image */
    margin-bottom: 12px;
    overflow: hidden;
}

/* Base class for background images in cards (e.g. index.php) */
.card-img-top-cover {
    background-size: cover;
    background-position: center;
    height: 250px;
    position: relative;
    width: 100%;
}

.card-image .badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Like Button (Visual Only) */
.card-like {
    position: absolute;
    top: 12px;
    right: 12px;
    color: white;
    font-size: 20px;
    opacity: 0.8;
}

.card-content {
    padding: 0 4px;
    /* Minimal padding */
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--primary-color);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}

.card-rating {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-address {
    font-size: 15px;
    color: #717171;
    /* Airbnb secondary text */
    margin-bottom: 6px;
}

.card-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 4px;
}

.card-price span {
    font-weight: 400;
}

.list-empty {
    text-align: center;
    padding: 60px 0;
    color: #717171;
}

/* Scrollbar */
.property-list-container::-webkit-scrollbar {
    width: 8px;
}

.property-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.property-list-container::-webkit-scrollbar-thumb {
    background-color: #dddddd;
    border-radius: 4px;
}

/* Map Popups */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: 260px !important;
}

.popup-image {
    width: 100%;
    height: 160px;
    background-size: cover;
    background-position: center;
    padding: 0;
    /* Ensures no padding issues */
}

.popup-info {
    padding: 12px;
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        /* Sidebar on top, Map Hidden */
        height: auto;
        overflow: visible;
    }

    .property-sidebar {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
        /* Allow full page scroll */
    }

    .map-container {
        display: none;
        /* Hide map on mobile */
    }

    .properties-grid {
        grid-template-columns: 1fr;
        /* Single column on mobile */
    }

    .sidebar-header {
        padding: 24px;
        /* Increased mobile padding */
        position: relative;
        /* Scrolls */
        top: auto;
        z-index: 1;
        box-shadow: none;
    }

    .property-list-container {
        padding: 24px;
    }

    /* Optimize property cards on mobile */
    .card-img-top-cover {
        height: 180px;
        /* Reduced height on mobile */
    }

    .card-image {
        height: auto !important;
        aspect-ratio: 3/2 !important;
        /* Force override for immobili.php cards: rimpicciolisci in proporzione */
        min-height: auto !important;
    }

    .property-card-hover .card-body {
        padding: 1rem !important;
        /* Compress padding inside card body */
    }

    .property-card-hover h5.card-title {
        font-size: 1.1rem;
        /* Slightly smaller title */
    }
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    background: #f7f7f7;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.layout-footer-links {
    display: flex;
    gap: 10px;
}

/* Custom Map Marker (High Visibility) */
.custom-marker {
    background-color: var(--primary-color) !important;
    /* Dark Blue Background */
    color: white !important;
    /* White Text */
    border-radius: 4px !important;
    /* Slightly rounded, almost rectangular tag */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
    /* Strong shadow */
    border: 1px solid white !important;
    /* White border for contrast */
    font-weight: 500;
    font-size: 13px !important;
    padding: 6px 10px !important;
    text-align: center;
    width: auto !important;
    height: auto !important;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    /* Center anchor */
}

/* Arrow tip for the marker */
.custom-marker::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: var(--primary-color) transparent transparent transparent;
}

.custom-marker:hover,
.marker-highlight {
    background-color: var(--accent-color) !important;
    /* Orange on hover */
    z-index: 1000 !important;
    transform: translate(-50%, -50%) scale(1.1);
}

.custom-marker:hover::after,
.marker-highlight::after {
    border-color: var(--accent-color) transparent transparent transparent;
}

/* 404 Page Styles (Transferred from 404.php) */
.landing-hero {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('../img/hero_bg.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 100px 0;
    text-align: center;
}

.landing-hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.card-contact {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    overflow: hidden;
}

.card-header-custom {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
    font-weight: bold;
}

.btn-luxe {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-luxe:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

/* --- Multipage Styles --- */

/* Navbar spacing for fixed header */
body {
    padding-top: 76px;
}

/* Home: Hero Section */
.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.5)), url('../img/hero.webp'), #333;
    background-size: cover;
    background-position: center;
    height: 64vh;
    min-height: 400px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cta-btn {
    background-color: var(--accent-color);
    color: white;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
}

.cta-btn:hover {
    background-color: #d1701b;
    transform: translateY(-3px);
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.testimonial-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    height: 100%;
}

/* Hero Immobili & Contatti Styles */
.contact-hero, .immobili-hero {
    background-size: cover;
    background-position: center;
    height: 32vh;
    min-height: 200px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: background 0.3s ease;
}

.immobili-hero {
    background: linear-gradient(rgba(0, 89, 161, 0.6), rgba(0, 89, 161, 0.8)), url('../img/hero.webp'), #333;
    background-size: cover;
    background-position: center;
}



.contact-hero {
    background: linear-gradient(rgba(241, 136, 37, 0.6), rgba(241, 136, 37, 0.8)), url('../img/hero.webp'), #333;
    background-size: cover;
    background-position: center;
}



.info-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.contact-icon-wrapper {
    width: 50px;
    height: 50px;
    background-color: rgba(0, 89, 161, 0.1);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.5rem;
}

/* Immobili Page Layout Overrides (Fixed layout removed) */
.filters {
    padding-top: 0;
}

@media (max-width: 900px) {
    .property-sidebar {
        width: 100%;
        max-width: 100%;
    }

    .map-container {
        display: none;
    }
}