/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 50px;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

/* Buttons */
.btn-primary {
    background-color: #00a8e8;
    color: white !important;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

/* Hero Section */
.hero-section {
    height: 60vh;
    background-color: #2c3e50; 
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 20px;
}

.search-bar {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.search-bar input {
    padding: 10px;
    border-radius: 5px;
    border: none;
}

/* The Grid */
.featured-section {
    padding: 50px;
}

.rental-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

/* The Item Card */
.item-card {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.item-card:hover {
    transform: translateY(-5px);
}

.item-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.item-details {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-details .price {
    font-weight: bold;
    color: #00a8e8;
}

.vat-extra {
    color: #dc3545;
    font-size: 0.8em;
    display: block;
    text-align: right;
    margin-top: 2px;
    font-weight: 500;
}

.vat-included {
    color: #28a745;
    font-size: 0.8em;
    display: block;
    text-align: right;
    margin-top: 2px;
    font-weight: 500;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    background-color: #333;
    color: white;
    margin-top: 40px;
}
.footer a {
    color: #00a8e8;
    text-decoration: none;
}

/* Details Page Styles */
.details-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 2fr 1fr; /* 2/3 for info, 1/3 for booking */
    gap: 40px;
}

.details-main img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}

.host-badge {
    display: inline-block;
    background-color: #e9ecef;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
    font-weight: bold;
}

/* The Booking Widget on the right */
.booking-widget {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.booking-widget h2 {
    margin-bottom: 20px;
}

.booking-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Details Page Mobile Stacking */
@media (max-width: 900px) {
    .details-container {
        grid-template-columns: 1fr !important; /* Stack content vertically on mobile */
        display: flex !important;
        flex-direction: column !important; /* Fallback for older mobile browsers */
    }
    .booking-widget {
        position: static !important; /* Remove sticky behavior on mobile so users can scroll past it */
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

.booking-form input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* ==========================================
   HEADER & NAVIGATION BAR STYLES
   This section controls the top menu bar of the website.
   ========================================== */

header {
    /* 'flex' allows us to put the logo on the left and links on the right */
    display: flex; 
    
    /* 'space-between' pushes the logo to the far left and nav to the far right */
    justify-content: space-between; 
    
    /* 'center' perfectly aligns them vertically so they aren't floating weirdly */
    align-items: center; 
    
    /* Adds 20px of space on the top/bottom, and 40px on the left/right */
    padding: 20px 40px; 
    
    background-color: white;
    
    /* Adds a tiny, soft shadow under the header to separate it from the page */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    
    flex-wrap: wrap;
    gap: 20px;
}

header nav {
    /* This makes the individual links sit next to each other */
    display: flex; 
    
    /* This forces exactly 20 pixels of space between every link */
    gap: 20px; 
    
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

header nav a {
    /* Removes the default blue underline from standard HTML links */
    text-decoration: none; 
    
    /* Sets the color to a dark gray for a modern look */
    color: #333; 
    
    font-weight: 500;
    position: relative;
    margin: 0;
    white-space: nowrap;
}

/* ==========================================
   AI CHAT WIDGET STYLES
   ========================================== */
.ai-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background-color: #00a8e8;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s;
    user-select: none;
}

.ai-chat-btn:hover {
    transform: scale(1.1);
}

.ai-chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 360px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid #eee;
}

.ai-chat-window.open {
    transform: scale(1);
}

@media (max-width: 480px) {
    .ai-chat-window {
        left: 12px !important;
        right: 12px !important;
        bottom: 88px !important;
        width: auto !important;
        max-width: none !important;
        height: min(560px, calc(100dvh - 120px)) !important;
        border-radius: 10px !important;
        transform-origin: bottom center !important;
    }

    .ai-chat-btn {
        right: 18px !important;
        bottom: 20px !important;
        width: 58px !important;
        height: 58px !important;
    }

    .chat-bubble {
        max-width: 92% !important;
        font-size: 0.95em;
    }
}

.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95em;
    line-height: 1.4;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.chat-bot {
    background: #f1f3f5;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-user {
    background: #00a8e8;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ==========================================
   RESPONSIVE HAMBURGER MENU
   ========================================== */
.hamburger {
    display: none;
    font-size: 1.8em;
    cursor: pointer;
    user-select: none;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.3s;
}

.hamburger:hover {
    background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
        order: 2; /* Position hamburger on the far right */
    }

    #user-actions {
        order: 1; /* Position user profile/login to the left of hamburger */
        justify-content: flex-end;
        min-width: auto !important;
        flex: 0 1 auto !important; /* Allow to shrink if necessary */
    }

    #main-nav {
        display: none !important; /* Overrides inline flex on desktop */
        width: 100% !important;
        min-width: 100% !important; /* Overrides inline min-width */
        flex-direction: column;
        order: 3; /* Dropdown appears below the header row */
        padding-top: 15px;
        margin-top: 10px;
        border-top: 1px solid rgba(0,0,0,0.1);
    }

    #main-nav.active {
        display: flex !important;
    }

    #main-nav .nav-tab {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================
   HOST DASHBOARD & FORMS MOBILE FIXES
   ========================================== */
@media (max-width: 768px) {
    /* Stack flex containers vertically */
    .mobile-stack {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    .mobile-stack > div {
        width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 10px !important;
        text-align: left !important;
        align-items: flex-start !important;
    }
    
    /* Collapse multi-column grids to a single column */
    .mobile-grid-1 {
        grid-template-columns: 1fr !important;
    }

    /* Calendars need horizontal scrolling on phones so inputs aren't crushed */
    .calendar-wrapper {
        overflow-x: auto;
        padding-bottom: 15px;
    }
    .calendar-grid {
        min-width: 700px !important;
    }
}

/* ==========================================
   VAT INFO TOOLTIP (POPUP)
   ========================================== */
.vat-tooltip-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    margin-top: 8px;
    font-size: 0.9em;
}
.vat-info-icon {
    background-color: #00a8e8;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    cursor: pointer;
    font-family: serif;
    font-weight: bold;
    outline: none;
}
.vat-popup-message {
    display: none;
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c3e50;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9em;
    width: 280px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    text-align: center;
    line-height: 1.4;
    pointer-events: none;
}
.vat-popup-message::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
}
.vat-info-icon:hover ~ .vat-popup-message,
.vat-info-icon:focus ~ .vat-popup-message {
    display: block;
}
