/* 
===================================
PROPERTY LISTINGS - REVAMPED v2.0
===================================
*/

:root {
    --primary-color: #4299e1;
    --primary-hover: #3182ce;
    --bg-body: #0a1628;
    --bg-nav: rgba(10, 22, 40, 0.95);
    --bg-card: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #a0aec0;
}

.light-mode {
    --bg-body: #f0f4f8;
    --bg-nav: rgba(240, 244, 248, 0.98);
    --bg-card: #fdfdfe;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-main: #2d3748;
    --text-muted: #718096;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0; padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s ease;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-overflow-scrolling: touch; /* Momentum scrolling for mobile */
}

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

/* --- NAVIGATION --- */
.top-nav {
    position: fixed; top: 0; left: 0; width: 100%; height: 70px;
    background: var(--bg-nav); backdrop-filter: blur(15px);
    z-index: 1000; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center;
}
.nav-container { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.nav-brand img { height: 35px; }
.nav-brand span { font-weight: 700; font-size: 1.1rem; }
.nav-links-desktop { display: flex; gap: 25px; }
.nav-links-desktop a { text-decoration: none; color: var(--text-muted); font-weight: 500; }
.nav-links-desktop a:hover, .nav-links-desktop a.active { color: var(--primary-color); }
.nav-actions { display: flex; align-items: center; gap: 15px; }
.theme-toggle-inline { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
.theme-toggle-inline:hover { color: var(--primary-color); }
.desktop-only { display: flex !important; }

/* --- ADMIN LOGIN BUTTON --- */
.admin-login-trigger {
    position: fixed; bottom: 25px; left: 25px;
    width: 45px; height: 45px; border-radius: 50%;
    background: var(--primary-color); border: none; color: white;
    font-size: 1.1rem; cursor: pointer; z-index: 1000;
    opacity: 0.4; transition: all 0.3s;
    display: flex; align-items: center; justify-content: center;
}
.admin-login-trigger:hover { opacity: 1; transform: scale(1.1); }
.admin-login-trigger.admin-active { opacity: 0.85; background: #e53e3e; }

/* --- MODALS & FORMS --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); display: none;
    justify-content: center; align-items: center; z-index: 6000;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: #111b27; padding: 35px; border-radius: 16px;
    width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto;
    position: relative; border: 1px solid var(--border-color);
    scrollbar-width: none;
}
.modal-content::-webkit-scrollbar { display: none; }
.light-mode .modal-content { background: #ffffff; }

.modal-close {
    position: absolute; top: 15px; right: 20px;
    background: none; border: none; color: var(--text-muted);
    font-size: 1.8rem; cursor: pointer; line-height: 1;
    transition: color 0.2s;
}
.modal-close:hover { color: var(--text-main); }

.modal-header { text-align: center; margin-bottom: 30px; }
.modal-header h2 { margin: 0 0 6px; font-size: 1.4rem; }
.modal-header p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.form-group { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.form-row { display: flex; gap: 20px; }
@media (max-width: 480px) { .form-row { flex-direction: column; gap: 0; } }

label { font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }
input, select, textarea {
    padding: 12px 15px; background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color); border-radius: 8px;
    color: var(--text-main); font-family: inherit; font-size: 1rem;
}
.light-mode input, .light-mode select, .light-mode textarea { background: #f9fafb; color: #1a202c; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-color); outline: none; }

/* --- UPLOAD UI --- */
.image-upload-options { margin-bottom: 20px; }
.video-upload-section { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.upload-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn {
    flex: 1; padding: 8px; border-radius: 8px;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-color);
    color: var(--text-muted); font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.tab-btn.active { background: var(--primary-color); border-color: var(--primary-color); color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.file-preview-name { margin-top: 8px; font-size: 0.8rem; color: var(--primary-color); font-weight: 600; }

.file-drop-area { 
    position: relative; padding: 35px 20px; border: 2px dashed var(--border-color);
    border-radius: 12px; text-align: center; cursor: pointer;
    background: rgba(255,255,255,0.02); transition: all 0.3s;
}
.file-drop-area:hover { border-color: var(--primary-color); background: rgba(66, 153, 225, 0.05); }
.file-drop-area i { font-size: 2rem; color: var(--primary-color); margin-bottom: 10px; display: block; }
.file-drop-area p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.file-drop-area input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* Toggle Switch Styling */
.toggle-container { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.toggle-input { display: none; }
.toggle-label {
    position: relative; width: 44px; height: 22px;
    background: rgba(255,255,255,0.1); border-radius: 20px;
    cursor: pointer; transition: background 0.3s;
    border: 1px solid var(--border-color);
}
.light-mode .toggle-label { background: rgba(0,0,0,0.05); }
.toggle-label::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; background: #fff;
    border-radius: 50%; transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-input:checked + .toggle-label { background: var(--primary-color); border-color: var(--primary-color); }
.toggle-input:checked + .toggle-label::after { transform: translateX(22px); }
.toggle-text { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.toggle-input:checked ~ .toggle-text { color: var(--primary-color); font-weight: 700; }

#propUrl { width: 100%; box-sizing: border-box; resize: vertical; min-height: 90px; }
.url-hint { margin: 0 0 8px; font-size: 0.8rem; color: var(--text-muted); }

/* File preview strip (thumbnails after selecting files) */
.file-preview-strip {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.file-preview-thumb {
    width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
    border: 2px solid var(--primary-color); position: relative;
    flex-shrink: 0;
}
.file-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-preview-thumb .thumb-remove {
    position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
    background: #e53e3e; border-radius: 50%; border: none; color: white;
    font-size: 0.65rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.upload-hint { font-size: 0.78rem; font-weight: 400; color: var(--text-muted); margin-left: 6px; }

.btn-full { width: 100%; margin-top: 10px; padding: 15px; font-size: 1rem; border-radius: 8px; cursor: pointer; }
.btn-primary { background: var(--primary-color); color: white; border: none; font-weight: 700; }
.btn-primary:hover { background: var(--primary-hover); }

/* --- ADMIN MODAL BUTTONS --- */
.admin-modal-buttons { display: flex; gap: 15px; margin-top: 25px; }
.admin-modal-buttons .btn { flex: 1; padding: 12px; border-radius: 8px; font-weight: 700; cursor: pointer; border: none; }
.btn-secondary { background: rgba(255, 255, 255, 0.05); color: white; border: 1px solid var(--border-color) !important; }
.light-mode .btn-secondary { color: #1a202c; background: rgba(0,0,0,0.05); }

/* --- SIDEBAR & OVERLAY --- */
.mobile-nav-toggle { display: none; }
.mobile-sidebar { display: none; }
.sidebar-overlay-dim { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1900; }

/* --- HEADER & FILTERS --- */
/* Top padding = nav height (70px) + small breathing room */
.listings-header { padding: 86px 0 6px; }
.header-flex { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.title-group h1 { font-size: 2.2rem; margin: 0; font-weight: 800; }
.title-group p { margin: 6px 0 0; color: var(--text-muted); font-size: 0.95rem; }
.accent-text { color: var(--primary-color); }
.listings-filter { 
    display: flex; 
    gap: 20px; 
    align-items: center; 
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
    max-width: 100%;
}
.listings-filter::-webkit-scrollbar { display: none; }

.filter-btn {
    padding: 7px 0; background: transparent; border: none;
    color: var(--text-muted); font-weight: 600; cursor: pointer;
    text-transform: uppercase; font-size: 0.82rem;
    border-bottom: 2px solid transparent; white-space: nowrap; transition: all 0.25s;
    flex-shrink: 0;
}
.filter-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.filter-btn:hover { color: var(--primary-color); }
.filter-divider {
    color: var(--border-color);
    font-size: 1.1rem;
    font-weight: 300;
    user-select: none;
}


/* --- ADMIN ACTIONS BAR (Right-aligned) --- */
.admin-actions {
    display: flex;
    justify-content: flex-end;
    padding: 10px 0 6px;
}
.admin-actions .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; border-radius: 10px; font-weight: 700;
    font-size: 0.92rem; cursor: pointer; border: none; transition: all 0.25s;
}
.admin-actions .btn i { font-size: 0.85rem; }

/* --- LISTINGS SECTION --- */
.listings-container { padding-bottom: 60px; }

/* --- GRID — with fade transition for filter changes --- */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding-top: 2px;
    /* Smooth filter switch: opacity fade without layout shift */
    transition: opacity 0.2s ease;
    /* min-height prevents page height collapsing during load — locks layout */
    min-height: 300px;
    /* GPU compositing layer — helps scroll performance */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: opacity;
}

/* ============================================
   PROFESSIONAL PROPERTY CARD
============================================ */
.property-card { 
    background: var(--bg-card);
    border: 1px solid var(--border-color); 
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease; 
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}
.property-card:hover { 
    transform: translateY(-6px); 
    box-shadow: 0 16px 40px rgba(0,0,0,0.25); 
}
.light-mode .property-card {
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.light-mode .property-card:hover {
    box-shadow: 0 14px 35px rgba(0,0,0,0.13);
}

/* Card Image — fixed, controlled height */
.property-image { 
    position: relative; 
    width: 100%; 
    height: 195px; 
    overflow: hidden;
    flex-shrink: 0;
}
.property-image img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.5s ease; 
    display: block;
}
.property-card:hover .property-image img { transform: scale(1.06); }

.card-video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.details-top-video-container {
    width: 100%;
    height: 320px;
    background: #000;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
}
.details-top-video-player {
    width: 100%;
    height: 100%;
    display: block;
}

/* Video Only Overlay */
.video-only-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: white;
    gap: 8px;
    pointer-events: none;
    z-index: 2;
}
.video-only-overlay i {
    font-size: 2.8rem;
    opacity: 0.9;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}
.video-only-overlay span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--primary-color);
    padding: 3px 10px;
    border-radius: 4px;
}

/* Badge */
.property-badge { 
    position: absolute; top: 12px; left: 12px; 
    padding: 4px 12px; 
    background: rgba(0,0,0,0.62); 
    backdrop-filter: blur(6px); 
    color: white;
    border-radius: 50px; 
    font-size: 0.7rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.8px; 
    z-index: 5;
}

/* Admin controls on card image */
.admin-card-controls { 
    position: absolute; top: 10px; right: 10px; 
    display: flex; gap: 6px; z-index: 10;
    opacity: 0; transform: translateY(-4px); transition: 0.25s;
}
.property-card:hover .admin-card-controls { opacity: 1; transform: translateY(0); }
.admin-btn { 
    width: 32px; height: 32px; border-radius: 8px; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; 
    color: white; font-size: 0.82rem; transition: transform 0.2s;
}
.admin-btn:hover { transform: scale(1.1); }
.admin-btn.edit { background: var(--primary-color); }
.admin-btn.delete { background: #e53e3e; }

/* Card content body */
.property-content { 
    padding: 18px 20px 16px; 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 6px;
}

.property-price { 
    font-size: 1.25rem; 
    font-weight: 800; 
    color: var(--primary-color); 
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.min-booking-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.sub-price-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: -8px;
    margin-bottom: 8px;
    opacity: 0.85;
}

.negotiable-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: #4299e1;
    background: rgba(66, 153, 225, 0.1);
    border: 1px solid rgba(66, 153, 225, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.property-title { 
    font-size: 1.05rem; 
    font-weight: 700; 
    color: var(--text-main); 
    margin: 0; 
    line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.property-location { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    margin-top: 2px;
}
.property-location i { color: var(--primary-color); font-size: 0.8rem; }

/* Multi-image count badge on card thumbnail */
.card-photo-count {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    color: white; padding: 3px 9px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 600; z-index: 5;
    display: flex; align-items: center; gap: 4px;
}

/* Video Indicator on Card */
.video-indicator {
    position: absolute; top: 10px; left: 10px;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    color: white; width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; z-index: 5;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Property Status Badge on Card */
.status-tag {
    position: absolute; top: 10px; right: 10px;
    padding: 4px 10px; border-radius: 4px;
    font-size: 0.7rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.5px; z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.status-tag.open { background: #22c55e; color: white; }
.status-tag.progress { background: #f59e0b; color: white; }
.status-tag.sold { background: #ef4444; color: white; }

.negotiable-tag {
    display: inline-block; font-size: 0.7rem; font-weight: 700;
    color: #4299e1; background: rgba(66, 153, 225, 0.1);
    padding: 2px 8px; border-radius: 4px; margin-left: 8px;
    vertical-align: middle;
}
.property-desc { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    line-height: 1.55; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden;
    margin: 4px 0 0;
    white-space: pre-wrap; /* Respect line breaks and spacing */
}

/* Card Footer — view details + share + inquire */
.property-footer { 
    margin-top: auto; 
    padding: 0 20px 18px; 
    display: flex; 
    gap: 10px;
    align-items: center;
}

.card-right-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.view-details-btn {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px 10px;
    background: rgba(66, 153, 225, 0.12);
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    font-family: inherit;
}
.view-details-btn:hover { 
    background: var(--primary-color); 
    color: white; 
}

/* Small icon-only share button */
.card-share-btn {
    width: 40px;
    height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s;
    flex-shrink: 0;
}
.card-share-btn:hover {
    background: rgba(66, 153, 225, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: scale(1.05);
}

.inquire-btn { 
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px 14px; 
    background: #25D366; 
    color: white;
    text-decoration: none; 
    border-radius: 10px; 
    font-weight: 700; 
    font-size: 0.85rem;
    transition: all 0.25s;
    border: 1.5px solid transparent;
    white-space: nowrap;
}
.inquire-btn:hover { background: #128C7E; }

/* ============================================
   VIEW DETAILS MODAL
============================================ */
.details-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.88);
    display: none; justify-content: center; align-items: center;
    z-index: 7000; padding: 20px; box-sizing: border-box;
}
.details-modal-overlay.active { display: flex; }

.details-modal {
    background: #0d1f35;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    overflow-y: auto;
    scrollbar-width: none;
    position: relative;
    animation: detailsSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-overflow-scrolling: touch; /* Smooth mobile scroll */
}
.details-modal::-webkit-scrollbar { display: none; }
.light-mode .details-modal { background: #ffffff; }

@keyframes detailsSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.details-modal-close {
    position: absolute; top: 14px; right: 18px;
    background: rgba(255,255,255,0.08); 
    border: 1px solid var(--border-color);
    color: var(--text-muted); font-size: 1.3rem; width: 36px; height: 36px;
    border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; z-index: 10;
}
.details-modal-close:hover { background: #e53e3e; color: white; border-color: #e53e3e; }
.light-mode .details-modal-close { background: rgba(0,0,0,0.06); }

/* Layout adjustments when carousel is hidden */
.details-modal.no-carousel {
    padding-top: 60px; /* space for the close button */
}
.details-modal.no-carousel .details-modal-close {
    background: rgba(255,255,255,0.15); /* make it more visible against background */
}
.light-mode .details-modal.no-carousel .details-modal-close {
    background: rgba(0,0,0,0.1);
}

/* ============================================
   IMAGE CAROUSEL (Details Modal)
============================================ */
.details-carousel {
    width: 100%;
    height: 280px;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    position: relative;
    background: #000;
    user-select: none;
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
    cursor: zoom-in;   /* tell user they can click to enlarge */
    position: relative;
}
.carousel-slide img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 0.5s ease;
    cursor: zoom-in;
    pointer-events: none; /* let the slide div handle the click, not the img */
}
.details-carousel:hover .carousel-slide img { transform: scale(1.03); }

/* Subtle "click to enlarge" hint that appears on hover */
.carousel-slide::after {
    content: '\f00e  Click to enlarge'; /* fa-search-plus */
    font-family: 'Inter', sans-serif;
    position: absolute;
    bottom: 12px; left: 50%; transform: translateX(-50%) translateY(6px);
    background: rgba(0,0,0,0.55);
    color: white; font-size: 0.72rem; font-weight: 600;
    padding: 5px 12px; border-radius: 20px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    z-index: 8;
}
.details-carousel:hover .carousel-slide::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Arrow buttons */
.carousel-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.2);
    color: white; font-size: 0.9rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 10; transition: all 0.2s;
    opacity: 0;
}
.details-carousel:hover .carousel-arrow { opacity: 1; }
.carousel-arrow:hover { background: rgba(66,153,225,0.8); border-color: transparent; transform: translateY(-50%) scale(1.08); }
.carousel-prev { left: 12px; }
.carousel-next { right: 12px; }
.carousel-arrow.hidden { display: none; }

/* Image counter top-right */
.carousel-counter {
    position: absolute; top: 14px; right: 14px;
    background: rgba(0,0,0,0.58); backdrop-filter: blur(4px);
    color: white; padding: 4px 10px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; z-index: 10;
}
.carousel-counter.single { display: none; }

/* Dot indicators */
.carousel-dots {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 6px; z-index: 10;
}
.carousel-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: rgba(255,255,255,0.45); border: none; cursor: pointer; padding: 0;
    transition: all 0.25s;
}
.carousel-dot.active { background: white; width: 18px; border-radius: 4px; }
.carousel-dots.single { display: none; }

/* Badge over carousel */
.details-hero-badge {
    position: absolute; top: 14px; left: 14px; z-index: 10;
    background: var(--primary-color);
    color: white; padding: 5px 14px; border-radius: 50px;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
}

/* Details body */
.details-body {
    padding: 28px 30px 30px;
}
.details-price {
    font-size: 2rem; font-weight: 800; color: var(--primary-color);
    margin-bottom: 6px; line-height: 1.2;
}
.details-title {
    font-size: 1.3rem; font-weight: 700; margin: 0 0 10px;
    color: var(--text-main); line-height: 1.4;
}
.details-location {
    display: flex; align-items: center; gap: 7px;
    color: var(--text-muted); font-size: 0.92rem; margin-bottom: 22px;
}
.details-location i { color: var(--primary-color); }

.details-divider {
    border: none; border-top: 1px solid var(--border-color); margin: 0 0 22px;
}

.details-section-label {
    font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted); margin-bottom: 10px;
}
.details-description {
    font-size: 0.95rem; color: var(--text-main); line-height: 1.75;
    margin-bottom: 28px;
    white-space: pre-wrap; /* Respect line breaks and spacing */
}

/* Details footer CTA */
.details-footer {
    display: flex; gap: 14px;
}
.details-inquire-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 9px;
    padding: 15px; background: #25D366; color: white;
    text-decoration: none; border-radius: 12px; font-weight: 700; font-size: 1rem;
    transition: all 0.25s;
}
.details-inquire-btn:hover { background: #128C7E; transform: translateY(-1px); }

.details-copy-link-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 15px 20px;
    background: rgba(66, 153, 225, 0.1);
    border: 1.5px solid var(--primary-color);
    border-radius: 12px; cursor: pointer; color: var(--primary-color);
    font-size: 0.9rem; font-weight: 700; transition: all 0.25s;
    font-family: inherit; white-space: nowrap;
}
.details-copy-link-btn:hover { background: var(--primary-color); color: white; }
.light-mode .details-copy-link-btn { background: rgba(66, 153, 225, 0.08); }

/* --- SKELETON LOADING --- */
.skeleton-card {
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}
.skeleton-card::before {
    content: '';
    display: block;
    height: 195px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.skeleton-card::after {
    content: '';
    display: block;
    height: 130px;
    background: rgba(255,255,255,0.03);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.light-mode .skeleton-card::before { background: linear-gradient(90deg, #e8ecf0 25%, #d1d8e0 50%, #e8ecf0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.light-mode .skeleton-card::after { background: #eef1f5; }

/* Loading / Empty / Error states */
.loading-state, .empty-state, .error-state {
    grid-column: 1 / -1; text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.loading-state i { font-size: 2rem; margin-bottom: 12px; display: block; color: var(--primary-color); }
.empty-state p, .error-state p { font-size: 1rem; }

/* Carousel slides are clickable to open lightbox */
.carousel-slide {
    cursor: zoom-in;
}

/* ============================================
   IMAGE LIGHTBOX (full-screen view, no download)
============================================ */
.lightbox-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.96);
    display: none; justify-content: center; align-items: center;
    z-index: 10000;
    flex-direction: column;
    animation: lbFadeIn 0.2s ease;
}
.lightbox-overlay.active { display: flex; }
@keyframes lbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 92vw;
    max-height: 84vh;
}

#lightboxImg {
    max-width: 92vw;
    max-height: 84vh;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    /* Prevent drag-to-desktop save */
    -webkit-user-drag: none;
    user-select: none;
    /* pointer-events none blocks right-click directly on img */
    pointer-events: none;
    animation: lbImgIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes lbImgIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* Transparent overlay sits ABOVE the image — catches all right-clicks */
.lightbox-blocker {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2; background: transparent;
    /* Disable default context menu on this blocker */
}

/* Close button */
.lightbox-close {
    position: fixed; top: 18px; right: 22px;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    color: white; font-size: 1.6rem; width: 44px; height: 44px;
    border-radius: 50%; cursor: pointer; z-index: 10001;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}
.lightbox-close:hover { background: #e53e3e; border-color: #e53e3e; }

/* Prev / Next arrows */
.lightbox-arrow {
    position: fixed; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    color: white; font-size: 1.1rem; width: 48px; height: 48px;
    border-radius: 50%; cursor: pointer; z-index: 10001;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.lightbox-arrow:hover { background: rgba(66,153,225,0.7); border-color: transparent; }
.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-arrow.hidden { display: none; }

/* Image counter */
.lightbox-counter {
    position: fixed; bottom: 50px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,0.7); font-size: 0.85rem; font-weight: 600;
    background: rgba(0,0,0,0.4); padding: 4px 14px; border-radius: 20px;
    z-index: 10001;
}
.lightbox-counter:empty { display: none; }

/* Hint text */
.lightbox-hint {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,0.35); font-size: 0.75rem;
    z-index: 10001; white-space: nowrap; pointer-events: none;
}

/* =============================================
   MOBILE PERFORMANCE — Reduce paint/composite
=============================================== */
/* Give the fixed nav its own composite layer so it doesn't repaint the page */
.top-nav {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* =============================================
   RESPONSIVE
=============================================== */
@media (max-width: 768px) {
    /* Smooth native scroll on iOS */
    body { -webkit-overflow-scrolling: touch; }

    .nav-links-desktop, .desktop-only { display: none !important; }
    .mobile-nav-toggle { display: block; background: none; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; }
    
    /* Header / Filters scrollable */
    .header-flex { flex-direction: column; align-items: flex-start; gap: 12px; }
    .listings-header { padding: 80px 0 0; }
    .listings-filter { 
        width: 100vw; 
        margin-left: -20px; 
        padding: 0 20px 10px;
        overflow-x: auto;
        display: flex;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, black calc(100% - 20px), transparent);
        mask-image: linear-gradient(90deg, black calc(100% - 20px), transparent);
        gap: 16px;
    }
    .listings-filter::-webkit-scrollbar { display: none; }
    .filter-btn { font-size: 0.78rem; white-space: nowrap; }
    .title-group h1 { font-size: 1.8rem; }
    
    /* Remove expensive backdrop-filter on mobile — biggest scroll perf win */
    .top-nav { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .property-badge { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .admin-login-trigger { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .carousel-arrow { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .card-photo-count { backdrop-filter: none; -webkit-backdrop-filter: none; }

    /* Disable hover lift on mobile — touch fires hover which triggers repaints during scroll */
    .property-card:hover { transform: none !important; box-shadow: none !important; }
    .property-card:hover .property-image img { transform: none !important; }
    /* Use active (tap) state instead for feedback */
    .property-card:active { transform: scale(0.98); transition: transform 0.1s; }

    /* Mobile sidebar */
    .mobile-sidebar {
        display: flex; flex-direction: column; position: fixed;
        top: 0; right: -100%; width: 300px; max-width: 85%; height: 100%;
        background-color: var(--bg-body); z-index: 9999;
        transition: right 0.35s ease; padding: 40px 30px;
        box-shadow: -10px 0 30px rgba(0,0,0,0.25);
        /* own layer */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    .light-mode .mobile-sidebar { background-color: #ffffff !important; }
    .mobile-sidebar.active { right: 0; }
    .sidebar-header-nav { display: flex; justify-content: flex-end; margin-bottom: 20px; }
    .sidebar-close { background: none; border: none; color: var(--text-muted); font-size: 2rem; cursor: pointer; }
    .sidebar-links { display: flex; flex-direction: column; gap: 20px; }
    .sidebar-links a { font-size: 1.2rem; font-weight: 600; color: var(--text-main); text-decoration: none; }
    .sidebar-links a.active { color: var(--primary-color); }
    .sidebar-theme-section { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border-color); }
    .sidebar-overlay-dim.active { display: block; opacity: 1; }

    /* Grid: 1 column on small mobile */
    .listings-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        /* Disable will-change on mobile to free up memory */
        will-change: auto;
    }
    
    /* Card image shorter on mobile */
    .property-image { height: 180px; }
    /* Disable the zoom animation on card images — expensive paint on mobile */
    .property-image img { transition: none; }
    
    /* Details modal hero shorter on mobile */
    .details-carousel { height: 210px; }
    /* Always show arrows on mobile (no hover) */
    .carousel-arrow { opacity: 1; width: 32px; height: 32px; font-size: 0.8rem; }
    /* Disable carousel track transition on slow devices, still feels fast with swipe */
    .carousel-track { will-change: auto; }
    .details-body { padding: 22px 20px 24px; }
    .details-price { font-size: 1.6rem; }
    .details-footer { flex-direction: column; }
    .details-copy-link-btn { width: 100%; justify-content: center; }
    
    /* Footer buttons */
    .property-footer { padding: 0 14px 14px; gap: 8px; }
    .property-content { padding: 14px 14px 10px; }

    /* Admin actions tighter on mobile */
    .admin-actions { padding: 8px 0 4px; }
}

@media (min-width: 481px) and (max-width: 768px) {
    /* 2-column grid for mid-size phones (landscape) */
    .listings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet: 2-column */
    .listings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
    }
}

/* =============================================
   MOBILE FLOATING FILTER & DRAWER
=============================================== */
.mobile-filter-trigger,
.filter-drawer,
.filter-drawer-overlay {
    display: none; /* Strictly hidden on desktop */
}

@media (max-width: 768px) {
    .mobile-filter-trigger {
        display: flex;
        position: fixed;
        bottom: 24px;
        left: 50%;
        transform: translateX(-50%);
        background: #1a2a40; /* Deep navy */
        color: white;
        padding: 12px 24px;
        border-radius: 50px;
        border: 1px solid rgba(255,255,255,0.15);
        font-weight: 700;
        font-size: 0.95rem;
        box-shadow: 0 10px 25px rgba(0,0,0,0.4);
        z-index: 6000;
        align-items: center;
        gap: 10px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    .mobile-filter-trigger.hidden {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }

    /* Drawer Overlay */
    .filter-drawer-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.6);
        display: none; z-index: 8000;
        opacity: 0; transition: opacity 0.3s ease;
    }
    .filter-drawer-overlay.active { display: block !important; opacity: 1; }

    /* Bottom Sheet Drawer */
    .filter-drawer {
        position: fixed;
        bottom: -100%;
        left: 0;
        width: 100%;
        background: #0d1f35;
        border-radius: 24px 24px 0 0;
        z-index: 8001;
        padding: 24px 20px 40px;
        transition: bottom 0.4s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
        max-height: 85vh;
        overflow-y: auto;
        display: none; /* Start hidden */
    }
    .light-mode .filter-drawer { background: #ffffff; }
    .filter-drawer.active { bottom: 0; display: block !important; }

    .drawer-header {
        display: flex; justify-content: space-between; align-items: center;
        margin-bottom: 24px; padding-bottom: 12px;
        border-bottom: 1px solid var(--border-color);
    }
    .drawer-header h3 { font-size: 1.2rem; font-weight: 700; margin: 0; color: var(--text-main); }
    .drawer-close { background: none; border: none; color: var(--text-muted); font-size: 2rem; cursor: pointer; }

    .drawer-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .drawer-item {
        background: rgba(255,255,255,0.04);
        border: 1px solid var(--border-color);
        color: var(--text-main);
        padding: 16px 12px;
        border-radius: 14px;
        font-size: 0.9rem;
        font-weight: 600;
        text-align: center;
        cursor: pointer;
        transition: all 0.2s;
    }
    .light-mode .drawer-item { background: #f8fafc; }
    .drawer-item:active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
    
    .drawer-divider {
        grid-column: 1 / -1;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 1px;
        margin: 15px 0 5px;
        text-align: center;
    }
}
