/* =========================================
   STAYFINDER GLOBAL DESIGN SYSTEM
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* The Brand Colors (You can easily change these later!) */
    --primary: #0d6efd;       /* The signature StayFinder Blue */
    --primary-hover: #0b5ed7;
    --danger: #dc3545;        /* For log out / delete buttons */
    
    /* Backgrounds & Text */
    --bg-color: #f8f9fa;      /* Soft off-white background */
    --card-bg: #ffffff;
    --text-main: #222222;
    --text-muted: #666666;
    
    /* UI Elements */
    --radius: 12px;           /* Smooth, modern rounded corners */
    --radius-sm: 6px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease-in-out;
}

/* Base Body Styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Global Navbar Polish */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    position: relative; /* Removed the sticky behavior so it scrolls away normally! */
    z-index: 1000;
}

.logo a {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary) !important;
    text-decoration: none !important;
    letter-spacing: -0.5px;
}

/* Global Button Polish */
.btn, button, .login-btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }

.btn-outline { background: white; border: 1px solid #ddd; color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* Beautiful Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================
   THE ULTIMATE COMPACT MOBILE POLISH
   ========================================= */
@media (max-width: 768px) {
    /* 1. Stop EVERYTHING from overflowing the screen */
    * { box-sizing: border-box !important; }
    body { overflow-x: hidden; width: 100%; }

    /* 2. Tighten up the main navbar box */
    .navbar {
        padding: 12px 10px !important;
        gap: 10px !important;
        flex-direction: column !important;
    }

    /* 3. The Nav Link Fix (Stops the hideous staggering) */
    .nav-links { 
        display: flex !important; 
        flex-direction: row !important; 
        flex-wrap: nowrap !important; /* Forces them onto a single line */ 
        justify-content: center !important; 
        align-items: center !important; 
        gap: 15px !important; 
        margin: 0 0 5px 0 !important; 
        padding: 0 !important; 
        list-style: none !important; 
        
    }
    
    .nav-links li {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .nav-links a {
        font-size: 0.9rem !important; /* Shrinks text slightly to fit */
        white-space: nowrap !important; /* Prevents text from breaking */
    }

    /* 4. The Magic Fix for the Button Cluster */
    .navbar > div:last-child {
        flex-direction: row !important; 
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
        width: 100% !important;
    }

    /* 5. Force the text to center on its own line */
    .navbar > div:last-child a:first-child {
        width: 100% !important;
        text-align: center !important;
        margin-bottom: 4px !important;
    }

    /* 6. Shrink the buttons so they fit neatly in a row */
    .navbar > div:last-child button, .login-btn, .btn {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
        margin: 0 !important;
        flex: 0 1 auto !important; 
    }

    /* 7. THE MISSING LAYOUT FIX (Stops the zoomed-out desktop look!) */
    .main-container {
        display: flex !important;
        flex-direction: column !important; /* Stacks sidebar ON TOP of results */
        padding: 10px !important;
    }

    /* Make the filter sidebar take full width */
    .filters, .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto 20px auto !important;
    }

    .results {
        width: 100% !important;
        padding: 0 !important;
    }

    /* 8. Stack the property cards properly AND FIX THE HEART BUTTON */
    .listing {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        position: relative !important; /* Crucial for the heart button to float correctly */
    }

    /* The Heart Button Fix */
    .heart-btn {
        position: absolute !important;
        top: 15px !important;
        left: 15px !important;
        width: 40px !important;
        height: 40px !important;
        background: white !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
        flex: none !important; /* STOPS IT FROM STRETCHING INTO A GIANT BAR */
        z-index: 10 !important;
    }

    .listing img {
        width: 100% !important;
        height: 200px !important;
        border-radius: 12px 12px 0 0 !important;
    }

    .listing-info, .listing-side {
        width: 100% !important;
        border-left: none !important;
        padding: 15px !important;
    }
    
    /* Puts the price and "View Details" side-by-side on mobile */
    .listing-side {
        border-top: 1px solid #eee !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    /* 9. THE LANDING PAGE OVERLAP FIX */
    .hero, .hero-section, .banner, section[style*="background"] {
        height: auto !important;
        min-height: fit-content !important;
        padding: 40px 15px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .search-container, .search-bar, .search-box, .hero form {
        position: relative !important;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        margin: 30px auto !important;
        height: auto !important;
        width: 100% !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    }

    /* 10. DETAILS PAGE MOBILE FIXES (The Anti-Crowding Protocol) */
    
    /* Push the back button down so it avoids the phone's camera notch */
    .back-btn, a[href*="explore.php"] {
        display: inline-block !important;
        margin-top: 15px !important; 
        margin-bottom: 10px !important;
    }

    /* Force the main layout to stack as a single column instead of side-by-side */
    .details-container, .container, .main-content {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        margin: 0 !important;
    }

    /* Shrink the overflowing Yellow & Gray booking/message boxes */
    .booking-card, .message-box, aside, div[style*="background-color"], div[style*="background:"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 15px 0 !important;
        padding: 15px !important;
    }

    /* Stop the images from cutting off */
    .details-gallery img, .details-container img, img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: cover !important;
        border-radius: 8px !important;
    }

    /* =========================================
       11. THE FINAL MOBILE OVERRIDES (BUG SQUASHERS)
       ========================================= */
       
    /* Force the Action Boxes on details.php to stack neatly! */
    .action-box {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        margin-top: 15px !important;
        position: relative !important; 
    }
    .action-card {
        width: 100% !important;
        min-width: 0 !important; /* Destroys the 280px limit causing the overlap */
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    /* Lock the Heart Button inside the image on explore.php! */
    .listing {
        position: relative !important;
    }
    .heart-btn {
        position: absolute !important;
        top: 10px !important;
        left: 10px !important;
        width: 35px !important;
        height: 35px !important;
        border-radius: 50% !important;
        background: white !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 100 !important;
        margin: 0 !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
        flex: none !important;
    }
}