/* ==========================================================================
   THEME: "MARKETPLACE PRO" - COMPLETE MODERN REDESIGN (FINAL)
   ========================================================================== */

/* 1. MODERN CSS RESET & VARIABLES
   ========================================================================== */
:root {
    /* Color Palette */
    --color-primary: #4A90E2; /* Professional, softer blue */
    --color-primary-dark: #357ABD;
    --color-secondary: #0D1B2A; /* Deep navy for text */
    --color-accent: #E57373; /* Soft red for notifications/favorites */
    --color-success: #66BB6A;
    --color-warning: #FFA726;
    --color-bg-light: #F8F9FA; /* Off-white page background */
    --color-bg-white: #FFFFFF;
    --color-text: #343A40;
    --color-text-muted: #6C757D;
    --color-border: #E9ECEF;

    /* Typography */
    --font-sans: 'Poppins', -apple-system, BlinkMacSystem-Font, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* Effects */
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.1);
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --transition-fast: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    background-color: var(--color-bg-light);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hero-banner {
    padding: 4rem 2rem; /* Reduced padding slightly */
    text-align: center;
    color: var(--color-secondary); /* Dark text for readability on light bg */
    background-color: rgba(255, 255, 255, 0.7); /* Optional: semi-transparent white box */
    border-radius: var(--border-radius-lg);
    margin-bottom: 3rem;
    backdrop-filter: blur(5px); /* Creates a modern "frosted glass" effect */
}

/* ==========================================================================
   1.5. NEW: HOMEPAGE HERO & CATEGORY GRID
   ========================================================================== */

.hero-section {
    background: var(--color-secondary);
    padding: 4rem 0;
    text-align: center;
    color: var(--color-bg-white);
}

.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.hero-search-form {
    max-width: 600px;
    margin: 0 auto 3rem auto;
    display: flex;
}
.hero-search-form input {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
}
.hero-search-form button {
    padding: 0 2rem;
    border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
}

.hero-categories h4 {
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
    margin: auto;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-bg-white);
    transition: var(--transition-fast);
}
.category-card:hover {
    transform: translateY(-5px);
    color: var(--color-primary);
}

.category-icon-placeholder {
    width: 70px;
    height: 70px;
    background-color: rgba(255,255,255,0.1);
    border-radius: var(--border-radius-lg);
}

.homepage-section {
    margin-bottom: 4rem;
}
.homepage-section h2 {
    font-size: 1.75rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

/* in public/assets/css/style.css */

.homepage-section {
    margin-bottom: 4rem;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.section-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
}
.view-all-link {
    text-decoration: none;
    font-weight: 500;
    color: var(--color-primary);
    transition: var(--transition-fast);
}
.view-all-link:hover {
    color: var(--color-primary-dark);
}

/* NEW: Horizontal Carousel Styles */
.listings-carousel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 85%; /* On mobile, each card takes up 85% of the width */
    gap: 1.5rem;
    overflow-x: auto; /* This enables horizontal scrolling */
    padding-bottom: 1.5rem; /* Add space for the scrollbar */
    
    /* Hide scrollbar for a cleaner, more native feel */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.listings-carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

@media (min-width: 768px) {
    .listings-carousel {
        grid-auto-columns: 30%; /* On tablet, show ~3 items */
    }
}
@media (min-width: 992px) {
    .listings-carousel {
        /* On desktop, show ~4 items. We use a calc for precision. */
        grid-auto-columns: calc(25% - 1.5rem);
    }
}
/* NEW: Mobile styles for the category grid */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0; /* Less padding on mobile */
    }
    .hero-content h1 {
        font-size: 2rem;
    }
    .hero-categories {
        /* On mobile, we make the container full-width to align the scroll area */
        max-width: 100%;
    }
    .category-grid {
        /* Convert the grid to a horizontal scrolling flexbox container */
        display: flex;
        overflow-x: auto; /* Enable horizontal scrolling */
        padding: 1rem 2rem; /* Add padding so cards don't touch the screen edges */
        
        /* This creates a "snap" effect for a native feel */
        scroll-snap-type: x mandatory; 

        /* Hide the scrollbar for a cleaner look */
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }
    .category-grid::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    .category-card {
        flex-shrink: 0; /* Prevent cards from shrinking */
        width: 100px; /* Give each card a fixed width */
        scroll-snap-align: start; /* Snap cards to the start of the container */
    }
}
/* 2. LAYOUT & CONTAINER
   ========================================================================== */
.container { max-width: 1280px; margin: auto; padding: 0 2rem; }
main.container { padding-top: 3rem; padding-bottom: 4rem; }


.page-header-banner {
    padding: 4rem 0; /* Vertical padding */
    margin-bottom: 5rem; /* Creates space for the overlapping filters */
    background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('../images/bg.png');
    background-size: cover;
    background-position: center;
}

.page-header-banner h1 {
    color: var(--color-bg-white);
    text-align: center;
    font-size: 2.5rem;
}

/* Make the filter sidebar white so it stands out */
.filter-sidebar {
    background-color: var(--color-bg-white);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium);
    height: fit-content;
}


/* 3. HEADER & NAVIGATION
   ========================================================================== */
.main-header {
    background: var(--color-bg-white);
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 1000;
}
.main-header nav { display: flex; align-items: center; justify-content: space-between; }
.main-header .logo { font-size: 1.75rem; font-weight: 600; color: var(--color-secondary); text-decoration: none; flex-shrink: 0; }

.header-search-form { display: flex; flex-grow: 1; margin: 0 2rem; }
.header-search-form input {
    width: 100%; border: 1px solid var(--color-border);
    padding: 0.75rem 1rem; border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
    border-right: none; transition: var(--transition-fast);
}
.header-search-form input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2); }
.header-search-form button {
    border: 1px solid var(--color-primary); background: var(--color-primary);
    color: var(--color-bg-white); padding: 0 1.5rem; border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
    cursor: pointer; transition: var(--transition-fast);
}
.header-search-form button:hover { background: var(--color-primary-dark); }

.main-header .nav-links { display: flex; align-items: center; list-style: none; gap: 1.5rem; margin: 0; }
.main-header .nav-links a { position: relative; text-decoration: none; color: var(--color-text-muted); font-weight: 500; transition: var(--transition-fast); }
.main-header .nav-links a:hover, .main-header .nav-links a.active { color: var(--color-primary); }

.notification-badge { background-color: var(--color-accent); color: var(--color-bg-white); font-size: 0.7rem; font-weight: 600; padding: 2px 6px; border-radius: 50px; position: absolute; top: -5px; }
:dir(ltr) .notification-badge { right: -10px; }
:dir(rtl) .notification-badge { left: -10px; }

.nav-item-dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; top: 150%; z-index: 1001;
    background-color: var(--color-bg-white);
    list-style: none; padding: 0.5rem 0; margin: 0;
    border: 1px solid var(--color-border); border-radius: var(--border-radius-md);
    min-width: 200px; box-shadow: var(--shadow-medium);
    opacity: 0; visibility: hidden; transition: top 0.2s ease, opacity 0.2s ease;
}
:dir(ltr) .dropdown-menu { left: 50%; transform: translateX(-50%); }
:dir(rtl) .dropdown-menu { right: 50%; transform: translateX(50%); }
.nav-item-dropdown:hover .dropdown-menu { display: block; top: 120%; opacity: 1; visibility: visible; }
.dropdown-menu li a { display: block; padding: 0.75rem 1.25rem; white-space: nowrap; }
.dropdown-menu li a:hover { background-color: var(--color-bg-light); }


/* 4. BUTTONS & FORMS
   ========================================================================== */
.btn {
    display: inline-block; font-weight: 600; text-align: center;
    text-decoration: none; vertical-align: middle; cursor: pointer;
    background-color: transparent; border: 1px solid transparent;
    padding: 0.75rem 1.5rem; font-size: 1rem;
    border-radius: var(--border-radius-md); transition: var(--transition-fast);
}
.btn-primary { color: var(--color-bg-white); background-color: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover { background-color: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-danger { color: var(--color-bg-white); background-color: var(--color-accent); border-color: var(--color-accent); }
.btn-success { color: var(--color-bg-white); background-color: var(--color-success); border-color: var(--color-success); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.875rem; }

.form-container { background: var(--color-bg-white); padding: 2.5rem; border-radius: var(--border-radius-lg); box-shadow: var(--shadow-medium); max-width: 600px; margin: 2rem auto; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
    display: block; width: 100%; padding: 0.75rem 1rem; font-size: 1rem;
    color: var(--color-text); background-color: var(--color-bg-white);
    border: 1px solid var(--color-border); border-radius: var(--border-radius-md);
    transition: var(--transition-fast);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

/* 5. LISTINGS & FILTERS
   ========================================================================== */
.listings-page-container { display: grid; grid-template-columns: 1fr; gap: 2.5rem; background: none; box-shadow: none; padding: 0; margin: 0; border: none; }
@media(min-width: 992px) { .listings-page-container { grid-template-columns: 300px 1fr; } }

.filter-sidebar { background: transparent; }
.filter-sidebar h4 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border); }
.filter-sidebar .form-group { margin-bottom: 2rem; }
.filter-sidebar .form-group label { font-weight: 600; margin-bottom: 0.75rem; font-size: 0.875rem; text-transform: uppercase; color: var(--color-text-muted); }
.filter-sidebar .form-group input, .filter-sidebar .form-group select { background-color: var(--color-bg-white); box-shadow: var(--shadow-soft); }
.price-range { display: flex; align-items: center; gap: 0.75rem; }
#filter-form button { width: 25%; margin-top: 1.5rem; padding: 0.875rem; font-size: 1.1rem; }

.listings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2rem; }
.listing-card { background: var(--color-bg-white); border-radius: var(--border-radius-lg); box-shadow: var(--shadow-soft); overflow: hidden; transition: var(--transition-fast); display: flex; flex-direction: column; }
.listing-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-medium); }
.listing-card-image-link { display: block; height: 220px; position: relative; overflow: hidden; background-color: var(--color-bg-light); }
.listing-card-image-link img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.listing-card:hover .listing-card-image-link img { transform: scale(1.05); }

.placeholder-image { width: 100%; height: 100%; background-color: var(--color-border); display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); font-weight: 500; }
.listing-card-content { padding: 1.5rem; position: relative; display: flex; flex-direction: column; flex-grow: 1; }
.listing-card-content h3 { font-size: 1.1rem; margin-bottom: 0.5rem; line-height: 1.4; }
.listing-card-content h3 a { text-decoration: none; color: var(--color-secondary); }
.listing-card .price { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); margin-bottom: 1rem; }
.listing-card .seller { font-size: 0.875rem; color: var(--color-text-muted); margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--color-border); }

.favorite-btn {
    position: absolute; font-size: 1.75rem; background: rgba(255,255,255,0.7);
    border: none; cursor: pointer; color: var(--color-text-muted); transition: var(--transition-fast);
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}
:dir(ltr) .favorite-btn { top: 1rem; right: 1rem; }
:dir(rtl) .favorite-btn { top: 1rem; left: 1rem; }
.favorite-btn:hover { transform: scale(1.2); }
.favorite-btn.active { color: var(--color-accent); }

.sponsored-badge {
    position: absolute; z-index: 10; padding: 0.3rem 0.75rem;
    background: linear-gradient(45deg, #FFD700, #F0C400); color: #4A2E04;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    border-radius: var(--border-radius-md); box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
:dir(ltr) .sponsored-badge { top: 1rem; left: 1rem; }
:dir(rtl) .sponsored-badge { top: 1rem; right: 1rem; }

.listing-detail { background: var(--color-bg-white); padding: 2.5rem; border-radius: var(--border-radius-lg); box-shadow: var(--shadow-medium); display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 992px) { .listing-detail { grid-template-columns: 2fr 1fr; } .listing-info { order: 1; } .listing-sidebar { order: 2; } }
.listing-gallery .main-image img { width: 100%; border-radius: var(--border-radius-lg); aspect-ratio: 4 / 3; object-fit: cover; }
.image-thumbnails { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem; margin-top: 1rem; }
.image-thumbnails .thumbnail { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--border-radius-md); cursor: pointer; border: 2px solid transparent; transition: var(--transition-fast); }
.image-thumbnails .thumbnail:hover, .image-thumbnails .thumbnail.active { border-color: var(--color-primary); }
.listing-sidebar .price { font-size: 2.5rem; font-weight: 800; color: var(--color-primary); margin-bottom: 1rem; }
.listing-sidebar .seller-info { border: 1px solid var(--color-border); padding: 1.5rem; border-radius: var(--border-radius-lg); text-align: center; }
.listing-sidebar .listing-actions { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }

/* 6. ADMIN PANEL
   ========================================================================== */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar { width: 260px; background-color: var(--color-secondary); color: #E5E7EB; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid #374151; }
.sidebar-header .logo { color: var(--color-bg-white); font-size: 1.25rem; }
.sidebar-nav { list-style: none; padding: 1rem 0; flex-grow: 1; }
.sidebar-nav li a { display: block; padding: 0.875rem 1.5rem; color: #D1D5DB; text-decoration: none; font-weight: 500; transition: var(--transition-fast); }
.sidebar-nav li a:hover, .sidebar-nav li a.active { background-color: #374151; color: var(--color-bg-white); }
.sidebar-nav hr { border: none; border-top: 1px solid #374151; margin: 1rem 1.5rem; }
.admin-main-content { flex-grow: 1; background-color: var(--color-bg-light); display: flex; flex-direction: column; }
.admin-topbar { background-color: var(--color-bg-white); padding: 1rem 1.5rem; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.admin-page-content { padding: 2rem; flex-grow: 1; }
.admin-page-content .form-container { margin: 0; max-width: 100%; }
.table-responsive {
    display: block; /* Ensures it behaves correctly on all browsers */
    width: 100%;
    overflow-x: auto; /* This is the key property that creates the horizontal scrollbar */
    
    /* Adds a nice fading effect on the edge of the scrollable area on mobile */
    
    /* A subtle border to contain the table */
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background: var(--color-bg-white);
}


.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0; /* Remove any margin */
    
    /* NEW: Prevent text from wrapping in the middle of words */
    white-space: nowrap; 
}

.admin-table th, .admin-table td { padding: 0.875rem 1.25rem; text-align: left; border-bottom: 1px solid var(--color-border); }
:dir(rtl) .admin-table th, :dir(rtl) .admin-table td { text-align: right; }
.admin-table th { background-color: var(--color-bg-light); }
.admin-topbar-actions .nav-item-dropdown:hover .dropdown-menu { left: auto; right: 0; transform: translateX(0); }
.admin-actions-form { display: flex; align-items: center; gap: 0.5rem; }
.admin-page-header { margin-bottom: 2rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.5rem; }
.dashboard-card { background-color: var(--color-bg-white); border-radius: var(--border-radius-lg); padding: 1.5rem; display: flex; align-items: center; gap: 1.5rem; text-decoration: none; color: var(--color-text); box-shadow: var(--shadow-soft); transition: var(--transition-fast); }
.dashboard-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-medium); }
.setting-image-preview { margin-top: 1rem; display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; color: var(--color-text-muted); }
.setting-image-preview img { height: 40px; background-color: var(--color-bg-light); border: 1px solid var(--color-border); border-radius: var(--border-radius-md); padding: 4px; }
.card-icon { flex-shrink: 0; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--color-bg-white); }
.card-icon.listings-icon { background-color: #3B82F6; }
.card-icon.users-icon { background-color: #10B981; }
.card-icon.categories-icon { background-color: #8B5CF6; }
.card-icon.reports-icon { background-color: #EF4444; }

/* 7. UTILITIES (Alerts, Modals, Badges, etc.)
   ========================================================================== */
.badge { display: inline-block; padding: .3em .65em; 
    font-size: 75%; font-weight: 700; line-height: 1; color: #000; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: 50px; }
.badge-success { background-color: var(--color-success); }
.badge-danger { background-color: var(--color-accent); }
.badge-warning { background-color: var(--color-warning); color: var(--color-secondary); }

#toast-container { position: fixed; top: 1.5rem; z-index: 9999; min-width: 320px; display: flex; flex-direction: column; gap: 1rem; }
:dir(ltr) #toast-container { right: 1.5rem; }
:dir(rtl) #toast-container { left: 1.5rem; }
.toast { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; background-color: var(--color-bg-white); border-radius: var(--border-radius-md); box-shadow: var(--shadow-medium); opacity: 0; transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); }
:dir(ltr) .toast { transform: translateX(100%); border-left: 5px solid; }
:dir(rtl) .toast { transform: translateX(-100%); border-right: 5px solid; border-left: none; }
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-color: var(--color-success); }
.toast-error { border-color: var(--color-accent); }
.toast-close-btn { background: none; border: none; font-size: 1.75rem; cursor: pointer; opacity: 0.6; color: inherit; transition: var(--transition-fast); }
:dir(ltr) .toast-close-btn { padding-left: 1.5rem; }
:dir(rtl) .toast-close-btn { padding-right: 1.5rem; }

.modal-wrapper { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(13, 27, 42, 0.7); z-index: 2000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-content { background: var(--color-bg-white); padding: 2.5rem; border-radius: var(--border-radius-lg); width: 90%; max-width: 500px; position: relative; }
.modal-close-btn { position: absolute; top: 0.5rem; background: none; border: none; font-size: 2rem; cursor: pointer; }
:dir(ltr) .modal-close-btn { right: 1rem; }
:dir(rtl) .modal-close-btn { left: 1rem; }

.static-page-container { background: var(--color-bg-white); padding: 2.5rem; border-radius: var(--border-radius-lg); box-shadow: var(--shadow-soft); }
.page-content { margin-top: 1.5rem; line-height: 1.8; }

/* ==========================================================================
   8. MESSAGING & CHAT (REDESIGNED)
   ========================================================================== */

.chat-container {
    max-width: 800px;
    margin: auto;
    background: var(--color-bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    height: 75vh; /* 75% of the viewport height */
}
.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
}
.chat-header p {
    margin: 0;
    color: var(--color-text-muted);
}

.chat-messages {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-bubble-wrapper {
    display: flex;
    max-width: 75%; /* Messages shouldn't be full width */
}
.message-bubble {
    padding: 0.75rem 1.25rem;
    border-radius: 1.25rem;
}

/* --- THIS IS THE CRITICAL LOGIC FOR ALIGNMENT --- */
.message-bubble-wrapper.sent {
    align-self: flex-end; /* Aligns the entire wrapper to the right */
}
.message-bubble-wrapper.sent .message-bubble {
    background-color: var(--color-primary);
    color: var(--color-bg-white);
    border-bottom-right-radius: 0.25rem;
}

.message-bubble-wrapper.received {
    align-self: flex-start; /* Aligns the entire wrapper to the left */
}
.message-bubble-wrapper.received .message-bubble {
    background-color: var(--color-border);
    color: var(--color-text);
    border-bottom-left-radius: 0.25rem;
}
/* --- END OF CRITICAL LOGIC --- */

.message-body {
    margin: 0;
    padding: 0;
    word-wrap: break-word; /* Prevents long words from overflowing */
}

.message-time {
    font-size: 0.75rem;
    display: block;
    margin-top: 0.25rem;
    opacity: 0.8;
}
.message-bubble-wrapper.sent .message-time {
    text-align: right;
    color: #E5E7EB;
}
.message-bubble-wrapper.received .message-time {
    text-align: left;
}

.chat-form-container {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-bg-light);
    flex-shrink: 0;
}
#new-message-form {
    display: flex;
    gap: 0.75rem;
}
#new-message-form textarea {
    flex-grow: 1;
    resize: none;
    height: 44px; /* Fixed height, can grow with JS if needed */
    padding: 0.5rem 1rem;
    border-radius: 50px; /* Pill shape */
    border: 1px solid var(--color-border);
}
#new-message-form button {
    border-radius: 50%; /* Make send button circular */
    width: 44px;
    height: 44px;
    padding: 0;
    flex-shrink: 0;
}


/* Inbox Styles (kept for completeness) */
.inbox-container h1 { margin-bottom: 2rem; }
.thread-list { background-color: var(--color-bg-white); border-radius: var(--border-radius-lg); box-shadow: var(--shadow-soft); overflow: hidden; }
.thread-item { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--color-border); transition: var(--transition-fast); }
.thread-item:last-child { border-bottom: none; }
.thread-item:hover { background-color: #F9FAFB; }

/* 9. FOOTER
   ========================================================================== */
.main-footer {
    background-color: var(--color-secondary); color: #ADB5BD;
    padding: 4rem 0 2rem 0; margin-top: 4rem; font-size: 0.9rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2.5rem; padding-bottom: 3rem; border-bottom: 1px solid #343A40; }
.footer-column h4 { color: var(--color-bg-white); font-size: 1.1rem; font-weight: 600; margin-bottom: 1.5rem; }
.footer-column ul { list-style: none; padding: 0; margin: 0; }
.footer-column ul li { margin-bottom: 0.75rem; }
.footer-column ul a { text-decoration: none; color: #ADB5BD; transition: var(--transition-fast); }
.footer-column ul a:hover { color: var(--color-bg-white); }
:dir(rtl) .footer-column ul a:hover { padding-right: 5px; }
.footer-bottom { padding-top: 2rem; text-align: center; font-size: 0.85rem; }
.social-links { display: flex; gap: 1rem; }
.social-links a { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background-color: #343A40; color: var(--color-bg-white); border-radius: 50%; text-decoration: none; font-weight: 600; font-size: 1.1rem; transition: var(--transition-fast); }
.social-links a:hover { background-color: var(--color-primary); transform: translateY(-3px); }


/* ==========================================================================
   10. RESPONSIVE ADJUSTMENTS
   ========================================================================== */

/* Hide mobile-only elements on desktop */
.nav-toggle, .admin-nav-toggle { 
    display: none; 
}
.admin-sidebar-overlay { 
    display: none; 
}

/* --- Mobile View (< 992px) --- */
@media (max-width: 992px) {
    /* --- Public Site Mobile Nav --- */
    .header-search-form {
        display: none; /* Hide the search form on mobile to save space */
    }

    .main-header .nav-links {
        display: none; 
        flex-direction: column; 
        position: absolute;
        top: 100%; 
        left: 0; 
        width: 100%;
        background-color: var(--color-bg-white); 
        box-shadow: var(--shadow-medium);
        padding: 1rem 0; 
        gap: 0;
    }
    .main-header .nav-links.active { 
        display: flex; 
    }
    .main-header .nav-links li { 
        margin: 0.5rem 0; 
        text-align: center; 
    }
    .nav-toggle { 
        display: block; 
        cursor: pointer; 
        font-size: 1.75rem; 
        border: none; 
        background: none; 
    }

    /* --- Admin Panel Mobile Nav --- */
    .admin-nav-toggle { 
        display: block; 
        cursor: pointer; 
        font-size: 1.5rem; 
        background: none; 
        border: none; 
        color: var(--color-secondary); 
    }
    :dir(ltr) .admin-nav-toggle { margin-right: 1rem; }
    :dir(rtl) .admin-nav-toggle { margin-left: 1rem; }

    .admin-sidebar { 
        position: fixed; 
        top: 0; 
        height: 100%; 
        width: 280px; 
        z-index: 1100; 
        transition: transform 0.3s ease; 
        box-shadow: var(--shadow-medium); 
    }
    :dir(ltr) .admin-sidebar { transform: translateX(-100%); }
    :dir(rtl) .admin-sidebar { transform: translateX(100%); }
    .admin-sidebar.active { 
        transform: translateX(0); 
    }
    
    .admin-sidebar-overlay.active { 
        display: block; 
        position: fixed; 
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%; 
        background-color: rgba(0,0,0,0.5); 
        z-index: 1099; 
    }
    
    .admin-main-content { 
        padding-top: 60px; /* Account for fixed top bar */ 
    }
    .admin-topbar { 
        position: fixed; 
        width: 100%; 
        top: 0; 
        z-index: 100; 
    }
}


/* Style for the current images grid in edit.php */
    .current-images-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 1rem;
        margin-top: 0.5rem;
    }
    .current-image-item {
        position: relative;
        aspect-ratio: 1 / 1;
    }
    .current-image-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: var(--border-radius-md);
        border: 1px solid var(--color-border);
    }
    .delete-image-btn {
        position: absolute;
        top: -5px;
        right: -5px; /* Adjust for LTR */
        background-color: var(--color-accent);
        color: white;
        border: 2px solid white;
        border-radius: 50%;
        width: 28px;
        height: 28px;
        font-size: 1.2rem;
        font-weight: bold;
        line-height: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--shadow-soft);
        transition: transform 0.2s;
    }
    :dir(rtl) .delete-image-btn {
        right: auto;
        left: -5px;
    }
    .delete-image-btn:hover {
        transform: scale(1.1);
    }


    .profile-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 992px) {
    .profile-container {
        grid-template-columns: 1fr 1fr;
    }
}
.profile-container .form-container {
    margin: 0; /* Override default margin */
}

/* Style for the link below login/register forms */
.form-footer-note {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.thread-actions { text-align: right; }
.star-rating { display: inline-block; font-size: 2.5rem; cursor: pointer; }
.star-rating .star { color: var(--color-border); transition: color 0.2s; }
.star-rating .star:hover,
.star-rating .star.selected { color: var(--color-warning); }


/* Style for the listing stats box */
.listing-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 1rem 0;
    margin: 1rem 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}
.stat-item .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-secondary);
}
.stat-item .stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}


/* Replace .category-icon-placeholder with this */
.category-icon {
    width: 70px;
    height: 70px;
    background-color: rgba(255,255,255,0.1);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem; /* For the fallback '?' */
}
.category-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Use 'contain' so icons don't get stretched */
    padding: 10px; /* Give the icon some breathing room */
}



/* ==========================================================================
   13. RESPONSIVE ADMIN STYLES (FINAL, CORRECTED VERSION 2)
   ========================================================================== */

/* --- DESKTOP FIRST STYLES (no media query) --- */
.admin-wrapper {
    display: flex; /* On desktop, we use flexbox for the sidebar layout */
    min-height: 100vh;
}
.admin-sidebar {
    width: 260px;
    flex-shrink: 0; /* Prevent the sidebar from shrinking */
}
.admin-main-content {
    flex-grow: 1; /* Allow the main content to take up the remaining space */
    width: calc(100% - 260px); /* Explicitly set width */
}
.admin-nav-toggle {
    display: none; /* Hide the hamburger on desktop */
}
.admin-sidebar-overlay {
    display: none; /* Hide the overlay on desktop */
}


/* --- MOBILE VIEW (< 992px) --- */
@media (max-width: 992px) {
    /* --- THIS IS THE CRITICAL FIX --- */
    .admin-wrapper {
        display: block; /* On mobile, STOP using flexbox */
    }

    .admin-main-content {
        width: 100%; /* Make the main content take up the full screen width */
    }
    /* --- END OF CRITICAL FIX --- */

    .admin-nav-toggle {
        display: block; /* Show the hamburger on mobile */
        font-size: 1.5rem;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--color-secondary);
    }
    :dir(ltr) .admin-nav-toggle { margin-right: 1rem; }
    :dir(rtl) .admin-nav-toggle { margin-left: 1rem; }

    .admin-sidebar {
        position: fixed;
        top: 0;
        height: 100%;
        width: 280px;
        z-index: 1100;
        box-shadow: var(--shadow-medium);
        transition: transform 0.3s ease;
    }
    :dir(ltr) .admin-sidebar {
        transform: translateX(-100%); /* Start off-screen */
    }
    :dir(rtl) .admin-sidebar {
        transform: translateX(100%); /* Start off-screen */
    }
    
    .admin-sidebar.active {
        transform: translateX(0); /* Slide into view */
    }
    
    .admin-sidebar-overlay.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.5);
        z-index: 1099;
    }
    
    .admin-main-content {
        padding-top: 60px; /* Account for fixed top bar */
    }
    .admin-topbar {
        position: fixed;
        width: 100%;
        top: 0;
        z-index: 100;
    }
}


/* ==========================================================================
   15. NEW: NATIVE APP BOTTOM NAVIGATION BAR
   ========================================================================== */

.bottom-nav {
    display: none; /* Hidden on desktop by default */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--color-bg-white);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
}

/* --- Show the bottom nav ONLY on mobile screens --- */
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }
    /* Add padding to the bottom of the body to prevent content
       from being hidden behind the new nav bar */
    body {
        padding-bottom: 60px;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    flex-grow: 1;
    height: 100%;
    transition: var(--transition-fast);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--color-primary);
}

.bottom-nav-item .nav-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

/* Special style for the central "Add Listing" button */
.bottom-nav-item.add-listing-btn {
    margin-bottom: 25px; /* Push the button up */
    background-color: var(--color-primary);
    color: var(--color-bg-white);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    border: 4px solid var(--color-bg-white);
    box-shadow: var(--shadow-medium);
}

.bottom-nav-item.add-listing-btn .nav-icon {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
}

.bottom-nav-item.add-listing-btn:hover {
    background-color: var(--color-primary-dark);
    transform: scale(1.05);
}

/* in style.css */

/* in style.css */

/* --- HERO SLIDER STYLES (ROBUST VERSION) --- */
.hero-slider-container { 
    position: relative; 
    width: 100%;
    height: 450px; /* Give the container a fixed height */
}

.slide {
    position: absolute; /* Stack all slides on top of each other */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    
    /* Control visibility with opacity */
    opacity: 0;
    transition: opacity 0.7s ease-in-out;
    z-index: 1; /* Inactive slides are behind */
}

.slide.active {
    opacity: 1; /* Make the active slide visible */
    z-index: 2; /* Bring the active slide to the front */
}

/* The dark overlay */
.slide::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
  
}

.slide-content { position: relative; z-index: 3; padding: 2rem; }
.slide-content h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.slide-content p { font-size: 1.2rem; margin-bottom: 1.5rem; }

.slider-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    padding: 0 1.5rem;
    z-index: 5; /* Ensure nav is above all slides */
}
.slider-nav-btn {
    background: rgba(0,0,0,0.4);
    color: white;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    transition: var(--transition-fast);
}
.slider-nav-btn:hover {
    background: rgba(0,0,0,0.7);
}

.hero-search-container { margin-top: -3rem; position: relative; z-index: 20; }
.hero-search-container form { box-shadow: var(--shadow-medium); }

.hero-search-container { margin-top: -3rem; position: relative; z-index: 20; }
.hero-search-container form { box-shadow: var(--shadow-medium); }

.message-sender {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--color-primary);
}


/* in public/assets/css/style.css */

/* ==========================================================================
   NEW: Image Preview Styles for Create/Edit Forms
   ========================================================================== */

#image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.image-preview {
    /* Set a fixed size for the preview thumbnails */
    width: 120px;
    height: 120px;
    
    /* Ensure the image covers the area without being distorted */
    object-fit: cover;
    
    /* Add some styling to make them look good */
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-soft);
}


/* in public/assets/css/style.css */

/* ==========================================================================
   NEW: Modern Styles for Listing Attributes
   ========================================================================== */

.listing-attributes h3 {
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.attributes-grid {
    display: grid;
    /* Create 2 columns of equal width */
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 2rem; /* Vertical and horizontal gap */
}

.attribute-item {
    background-color: var(--color-bg-light);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
}

.attribute-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.attribute-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-secondary);
}

/* --- Responsive Adjustment for Mobile --- */
@media (max-width: 768px) {
    .attributes-grid {
        /* On small screens, stack to a single column */
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}


/* in public/assets/css/style.css */

/* NEW: Site-wide Alert Banner Styles */
.site-alert-banner {
    padding: 0.75rem 0;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
}

.site-alert-banner p {
    margin: 0;
}

.site-alert-banner a {
    font-weight: 600;
    text-decoration: underline;
}

.site-alert-banner.alert-warning {
    background-color: #FFF3CD; /* A light yellow */
    color: #664d03;
}
.site-alert-banner.alert-warning a {
    color: #664d03;
}

