/* --- Dashboard Styles --- */

/* Override global body styles for dashboard */
body {
    display: block;
    padding: 0;
    height: auto;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: transparent; /* Transparent initially */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

/* Navbar Text Colors (Dynamic) */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    transition: color 0.3s;
}

.nav-back-btn {
    background: transparent;
    border: none;
    color: inherit; /* Inherits from nav-brand */
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    margin-right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.nav-back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.navbar.scrolled .nav-back-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.navbar.scrolled .nav-brand {
    color: var(--primary-color);
}

.navbar .logo-img {
    filter: brightness(0) invert(1); /* White logo initially */
    transition: filter 0.3s;
}

.navbar.scrolled .logo-img {
    filter: none; /* Original logo color on scroll */
}

.nav-brand i {
    font-size: 24px;
}

.nav-brand h1 {
    font-size: 22px;
    font-weight: 700;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.add-ad-btn-nav {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.login-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    text-decoration: none;
}

.navbar.scrolled .add-ad-btn-nav {
    background: var(--primary-color);
    color: white;
    border-color: transparent;
}

.navbar.scrolled .login-nav-btn {
    background: var(--primary-color);
    color: white;
    border-color: transparent;
}

.add-ad-btn-nav:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.login-nav-btn:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Notification Bell */
.notification-wrapper {
    position: relative;
}

.notification-bell {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.2);
}

.navbar.scrolled .notification-bell {
    color: var(--text-color);
}

.navbar.scrolled .notification-bell:hover {
    background: rgba(0, 0, 0, 0.05);
}

.notification-bell i {
    font-size: 20px;
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid transparent;
}

.navbar.scrolled .notification-badge {
    border-color: white;
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: 120%;
    right: -80px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: hidden;
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.mark-read-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.mark-read-btn:hover {
    text-decoration: underline;
}

.notification-list {
    max-height: 350px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: #f9f9f9;
}

.notification-item.unread {
    background: #f0f7ff;
}

.notification-item.unread:hover {
    background: #e6f2ff;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e6f2ff;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 13px;
    color: var(--text-color);
    margin-bottom: 4px;
    line-height: 1.4;
}

.notification-time {
    font-size: 11px;
    color: #888;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #888;
}

.empty-state i {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Profile Dropdown */
.nav-profile {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 30px;
    transition: background 0.2s;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.navbar.scrolled .profile-trigger:hover {
    background: var(--bg-color);
}

.avatar {
    width: 40px;
    height: 40px;
    background: white;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

.navbar.scrolled .avatar {
    background: var(--primary-color);
    color: white;
    border: none;
}

.profile-trigger .fa-chevron-down {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s;
}

.navbar.scrolled .profile-trigger .fa-chevron-down {
    color: var(--text-light);
}

/* Hero Section */
.hero-section {
    padding-top: 120px; /* More space for navbar */
    padding-bottom: 40px; /* Reduced from 80px */
    padding-left: 5%;
    padding-right: 5%;
    /* Modern Gradient: Blue-600 to New Darker Background */
    background: linear-gradient(180deg, #2563EB 0%, #E2E8F0 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.search-section {
    display: flex;
    gap: 15px;
    width: 100%;
    max-width: 100%; /* Full width */
}

/* Main Content Area */
.main-content {
    margin-top: 0; /* Removed margin since Hero takes space */
    width: 100%;
    max-width: 1200px;
    padding: 0 0 40px 0;
    margin-left: auto;
    margin-right: auto;
}

/* Search Bar Styling Update */
.search-bar {
    flex: 1;
    background: var(--white);
    padding: 18px 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); /* Stronger shadow for floating effect */
    border: 1px solid transparent;
    transition: all 0.3s;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 0 30px;
    border-radius: 15px;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.filter-btn:hover {
    background: white;
    transform: translateY(-2px);
}

.dropdown-menu {
    position: absolute;
    top: 120%;
    right: 0;
    width: 260px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    padding: 10px 0;
    display: none; /* Hidden by default */
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.dropdown-menu.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--text-color);
}

.user-email {
    font-size: 12px;
    color: var(--text-light);
}

.menu-items {
    list-style: none;
    padding: 10px 0;
}

.menu-items li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.menu-items li a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.menu-items li a i {
    width: 20px;
    text-align: center;
}

.premium-link {
    color: #f1c40f !important;
    font-weight: 500;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

.logout-item {
    color: #dc3545 !important;
}

/* Main Content Area */
.main-content {
    margin-top: 0; /* Removed margin since Hero takes space */
    width: 100%;
    max-width: 1200px;
    padding: 0 20px 40px 20px;
    margin-left: auto;
    margin-right: auto;
}

/* Search & Filters */
/* Removed .search-section styles from here as they are now in Hero Section block */

.search-bar {
    flex: 1;
    background: var(--white);
    padding: 18px 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); /* Stronger shadow for floating effect */
    border: 1px solid transparent;
    transition: all 0.3s;
}

.search-bar:focus-within {
    border-color: var(--primary-color);
}

.search-bar i {
    color: var(--text-light);
}

.search-bar input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 16px;
    color: var(--text-color);
}

.filter-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 0 30px;
    border-radius: 15px;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.filter-btn:hover {
    background: white;
    transform: translateY(-2px);
}

/* Responsive Adjustments for Dashboard */
@media (max-width: 768px) {
    .navbar {
        padding: 0 20px;
    }

    .nav-actions {
        gap: 12px;
    }

    .nav-brand h1 {
        font-size: 18px;
    }

    .add-ad-btn-nav {
        padding: 8px 16px;
    }
    
    .hero-section {
        padding-top: 100px;
        padding-bottom: 40px;
    }

    .search-bar {
        padding: 12px 20px;
    }

    .filter-btn {
        padding: 0 20px;
    }
    
    .dropdown-menu {
        position: fixed;
        top: 80px;
        right: 20px;
        left: auto;
        width: 66vw; /* 2/3 of viewport width */
        max-width: 300px;
        max-height: calc(100dvh - 110px);
        overflow-y: auto;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
        padding: 15px 0;
    }
}

@media (max-width: 420px) {
    .navbar {
        padding: 0 14px;
    }

    .nav-brand h1 {
        display: none;
    }

    .add-ad-btn-nav {
        font-size: 0; /* hide text, keep icon */
        padding: 10px 12px;
        gap: 0;
    }

    .add-ad-btn-nav i {
        font-size: 16px;
    }
}

@media (max-width: 500px) {
    .search-section {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
        justify-content: center;
        padding: 15px;
    }
}

/* Ad Card Styles */
.content-grid {
    /* Masonry Layout using CSS Columns */
    column-count: 4;
    column-gap: 20px;
    padding: 10px 0 80px 0;
    width: 100%;
}

/* Responsive Columns */
@media (max-width: 1200px) {
    .content-grid {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    .content-grid {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .content-grid {
        column-count: 1;
    }
}

.ad-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.5);
    
    /* Masonry specific */
    break-inside: avoid; /* Prevent card from splitting across columns */
    margin-bottom: 30px; /* Space between items vertically */
    transform: translateZ(0); /* Fix for some rendering glitches */
}

.ad-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 10; /* Bring to front on hover */
}

.ad-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.ad-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ad-user-info {
    display: flex;
    flex-direction: column;
}

.ad-username {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-color);
}

.ad-image-container {
    width: 100%;
    height: auto; /* Dynamic height based on image */
    background: #f8fafc;
    overflow: hidden;
    position: relative;
    min-height: 200px; /* Minimum height while loading */
}

.ad-image {
    width: 100%;
    height: auto; /* Maintain aspect ratio */
    max-height: 50vh; /* Limit height to 50% of viewport */
    object-fit: cover; /* Crop image if it exceeds max-height */
    display: block; /* Remove bottom space */
    transition: transform 0.5s ease;
}

.ad-card:hover .ad-image {
    transform: scale(1.05);
}

.ad-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.ad-content h3 {
    font-size: 20px; /* Larger title */
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a202c; /* Darker, sharper text */
    line-height: 1.4;
}

.ad-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.ad-description {
    font-size: 15px;
    color: #64748b; /* Slate-500 for better readability */
    line-height: 1.6; /* Improved readability */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile Post Ad FAB */
.mobile-post-ad-btn {
    display: none; /* Hidden by default on desktop */
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-color);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    z-index: 1000;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mobile-post-ad-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.mobile-post-ad-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .mobile-post-ad-btn {
        display: flex;
    }
    
    .add-ad-btn-nav {
        display: none;
    }
}

/* Filter Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); 
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto; 
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 15px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e293b;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
    text-decoration: none;
}

.modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #475569;
    font-size: 0.95rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-row {
    display: flex;
    gap: 20px;
}

.filter-row .filter-group {
    flex: 1;
}

.price-inputs {
    display: flex;
    gap: 10px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: #f8fafc;
    border-radius: 0 0 15px 15px;
}

.btn-secondary {
    padding: 10px 20px;
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f1f5f9;
}

.btn-primary {
    padding: 10px 20px;
    background: var(--primary-color);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* Slider Styles */
.noUi-target {
    border: none;
    background: #e2e8f0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
    height: 6px;
    border-radius: 3px;
    margin: 15px 0; /* Add vertical spacing */
}

.noUi-connect {
    background: var(--primary-color);
    border-radius: 3px;
}

.noUi-handle {
    width: 12px !important;
    height: 28px !important;
    right: -6px !important;
    top: -6.5px !important;
    border: 2px solid white;
    background: var(--primary-color);
    border-radius: 4px;
    cursor: grab;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.2s;
}

.noUi-handle:hover {
    transform: scale(1.05);
    background: var(--primary-dark);
}

.noUi-handle:active {
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.noUi-handle:before, .noUi-handle:after {
    display: none !important;
}
