@import "theme.css";

/* Home Page Stylesheet - Modernized */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    overflow-x: hidden;
}

/* Navbar */
.navbar {
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95) !important;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand img {
    transition: transform 0.3s ease;
}

.navbar-brand:hover img {
    transform: scale(1.1) rotate(5deg);
}

.nav-link {
    font-weight: 500;
    color: #64748b !important;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--primary) !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* ============================================
   MODERNIZED MEGA MENU
   ============================================ */

.mega-menu {
    width: 90vw !important;
    max-width: 1000px !important;
    left: 100% !important;
    transform: translateX(-70%) !important;
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    background: white;
    margin-top: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
    padding: 0;
}

.dropdown:hover .mega-menu,
.dropdown.show .mega-menu {
    opacity: 1;
    visibility: visible;
    margin-top: 0.5rem;
}

/* Mega Menu Header - Gradient Section */
.mega-menu-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0.5rem;
    color: white;
}

.mega-menu-header h5 {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.1rem;
}

.mega-menu-header .text-muted {
    color: rgba(255,255,255,0.85) !important;
    font-size: 0.9rem;
}

/* Mega Menu Body - Scrollable Content Area */
.mega-menu-body {
    padding: 2rem;
    max-height: 400px;
    overflow-y: auto;
}

.mega-menu-body::-webkit-scrollbar {
    width: 6px;
}

.mega-menu-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.mega-menu-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.mega-menu-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mega Menu Footer */
.mega-menu-footer {
    padding: 1.5rem 2rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.mega-menu-footer .btn-primary {
    background: var(--gradient-1);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    padding: 0.875rem;
    transition: all 0.3s ease;
}

.mega-menu-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Category Cards in Mega Menu */
.category-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-1);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.15);
}

.category-card:hover::before {
    transform: scaleY(1);
}

.category-icon-wrapper {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.category-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.category-card:hover .category-icon-wrapper {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.category-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
    display: block;
}

.category-count {
    font-size: 0.8rem;
    color: #64748b;
    display: block;
}

.category-arrow {
    color: #cbd5e1;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.category-card:hover .category-arrow {
    color: var(--primary);
    transform: translateX(5px);
}

/* ============================================
   END MEGA MENU STYLES
   ============================================ */

.btn-primary {
    background: var(--gradient-1);
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Hero Section */
.hero {
    background: var(--gradient-1);
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero .lead {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    opacity: 0.95;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.search-form {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.search-form .input-group {
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.search-form .input-group:hover {
    box-shadow: 0 25px 70px rgba(0,0,0,0.2);
}

.search-form .form-control,
.search-form .form-select {
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

.search-form .form-control:focus,
.search-form .form-select:focus {
    box-shadow: none;
    outline: none;
}

.search-form .btn {
    padding: 1rem 2.5rem;
    border-radius: 0 50px 50px 0;
    font-weight: 600;
}

/* Hero Cards */
.hero-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    animation: fadeInRight 0.8s ease-out 0.6s both;
}

.hero-cards .no-image-svg {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    right: 40%;
    bottom: 30%;
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.featured-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.featured-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}


.card-img {
    height: 120px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 100%);
}

.featured-card .card-body {
    padding: 1rem;
}

.featured-card h6 {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.featured-card .price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

/* Main Content */
main {
    margin-top: -2rem;
    position: relative;
    z-index: 10;
}

section {
    margin-bottom: 4rem;
}

h3 {
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--gradient-1);
    border-radius: 2px;
}

/* Category Boxes */
.cat-box {
    display: block;
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
}

.cat-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.cat-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cat-icon-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.cat-box:hover .cat-icon {
    transform: scale(1.1) rotate(5deg);
}

.cat-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
}

/* Ad Cards */
.listing-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    background: white;
}

.listing-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.ad-image, .listing-list-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.ad-image img, .listing-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 0.2rem;
    display: block;
}

.ad-image .no-image-svg, .listing-list-image .no-image-svg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#f1f5f9 0%, #e2e8f0 100%);
    color: #64748b;
}

.no-image-svg i {
    font-size: 2.25rem;
    color: #94a3b8;
}

.ad-image::before, .listing-list-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.1) 100%);
    transition: all 0.3s ease;
}

.listing-card:hover .ad-image::before, .listing-card:hover .listing-list-image::before {
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.2) 100%);
}

.listing-card .card-body {
    padding: 1.25rem;
}

.listing-card .card-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listing-card .price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.3rem;
}

.listing-card .btn-sm {
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
}

/* Why Choose Section */
.why-choose {
    background: white;
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--shadow-md);
}

.why-choose ul li {
    padding: 0.75rem 0;
    font-size: 1.1rem;
    color: #475569;
    position: relative;
    padding-left: 2rem;
}

.why-choose ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
    font-size: 1.3rem;
}

/* Stats Section */
.stats-section {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 3rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: #64748b;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Footer */
footer {
    background: #1e293b;
    color: white;
    padding: 2rem 0;
    margin-top: 5rem;
}

footer .text-muted {
    color: #94a3b8 !important;
}

/* Buttons */
.btn-outline-secondary {
    border-radius: 50px;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-width: 2px;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary {
    border-radius: 50px;
    font-weight: 600;
    border-width: 2px;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 991px) {
    .hero-title {
        font-size: 2.5rem;
    }

    h3 {
        font-size: 1.75rem;
    }

    .hero {
        padding: 3rem 0 2rem;
    }

    .mega-menu {
        width: 90vw;
        left: 5vw !important;
        transform: translateX(0) !important;
        max-width: none;
        max-height: 80vh;
    }

    .mega-menu-body {
        max-height: 90vh;
    }

    .category-card {
        padding: 0.875rem;
    }

    .category-icon-wrapper {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 1rem;
    }

    .category-name {
        font-size: 0.875rem;
    }

    .category-count {
        display: flex;
        flex-direction: row-reverse;
        font-size: 0.75rem;
        position: absolute;
        right: 5px;
        background: teal;
        border: 1px solid white;
        border-radius: 10px;
        padding: 0.2rem;
        color: white;
    }
}

@media (max-width: 767px) {
    .hero-title {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }
    .popular-cats .btn-outline-secondary::after,
    .featured-ads .btn-outline-secondary::after,
    .recent-ads .btn-outline-secondary::after,
    .trending-ads .btn-outline-secondary::after {
        font-size: 14px;
        font-weight: 600;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        color: inherit;
    }

    .search-form .form-select {
        border-radius: 50px;
    }

    .search-form .btn {
        border-radius: 50px;
    }

    .mega-menu {
        width: 95vw;
        left: 2.5vw !important;
        border-radius: 16px;
    }

    .mega-menu-header {
        padding: 1.25rem 1.5rem;
    }

    .mega-menu-header h5 {
        font-size: 1.1rem;
    }

    .mega-menu-body {
        padding: 1.5rem;
    }

    .mega-menu-footer {
        padding: 1.25rem 1.5rem;
    }

    .category-card {
        text-align: center;
        gap: 0.75rem;
    }
}

/* Loading Animation */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Offcanvas adjustments */
.offcanvas {
    height: 100vh !important;
}

.offcanvas .dropdown-menu {
    position: relative;
    width: 100%;
    box-shadow: none;
    border: none;
    background: transparent;
}


.offcanvas .mega-menu {
    width: 100% !important;
    left: 0 !important;
    transform: none !important;
    max-width: none !important;
}

/* Hide offcanvas mega menu on desktop to prevent interference */
@media (min-width: 992px) {
    .offcanvas .mega-menu {
        display: none !important;
    }
}

.offcanvas-header {
    background: var(--gradient-1);
    color: white;
    padding: 1rem 1.5rem;
    border-bottom: none;
}

.offcanvas .navbar-brand {
    color: white !important;
    font-weight: 700;
    font-size: 1.25rem;
}

.offcanvas-open {
    overflow: hidden;
}

.offcanvas .mega-menu-body {
    max-height: 100vh;
    overflow-y: auto;
    scroll-behavior: auto;
    scrollbar-width: none;
    scrollbar-gutter: stable;
}

.offcanvas .mega-menu-body .category-arrow {
    position: absolute;
    right: 20%;
}

.offcanvas .mega-menu-body::-webkit-scrollbar {
    display: none;
}

.offcanvas-body
{
    padding: 0 !important;
}

.offcanvas-header .btn-close {
    color: white !important;
    filter: invert();
}

.offcanvas .mobile-add-btn {
  width: 90% !important;
}

.offcanvas-body .category-card {
    text-align: start;
}

/* ============================================
   DARK MODE STYLES FOR HOME PAGE
   ============================================ */

html.dark-mode .hero {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
    color: var(--text-primary);
}

html.dark-mode .hero h1,
html.dark-mode .hero h2 {
    color: var(--text-primary);
}

html.dark-mode .hero p {
    color: var(--text-secondary);
}

html.dark-mode .stats-section {
    background: var(--bg-primary);
    color: var(--text-primary);
}

html.dark-mode .stat-item {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

html.dark-mode .stat-number {
    color: var(--primary);
}

html.dark-mode .stat-label {
    color: var(--text-secondary);
}

html.dark-mode .popular-cats {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

html.dark-mode .cat-box {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

html.dark-mode .cat-box:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

html.dark-mode .cat-name {
    color: var(--text-primary);
}

html.dark-mode .cat-count {
    color: var(--text-secondary);
}

html.dark-mode .featured-ads,
html.dark-mode .recent-ads,
html.dark-mode .trending-ads {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

html.dark-mode .featured-ads h2,
html.dark-mode .recent-ads h2,
html.dark-mode .trending-ads h2 {
    color: var(--text-primary);
}

html.dark-mode .listing-card {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

html.dark-mode .listing-card .card-body {
    background: var(--card-bg);
    color: var(--text-primary);
}

html.dark-mode .listing-card .card-title {
    color: var(--text-primary);
}

html.dark-mode .listing-card .text-muted {
    color: var(--text-secondary);
}

html.dark-mode .why-choose {
    background: var(--bg-primary);
    color: var(--text-primary);
}

html.dark-mode .feature-card {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

html.dark-mode .feature-card:hover {
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

html.dark-mode .feature-icon {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

html.dark-mode .search-bar input,
html.dark-mode .search-bar select {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

html.dark-mode .search-bar input::placeholder {
    color: var(--text-muted);
}

html.dark-mode .search-bar input:focus,
html.dark-mode .search-bar select:focus {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

html.dark-mode .ads-grid,
html.dark-mode .ads-list {
    color: var(--text-primary);
}

html.dark-mode .view-toggle .btn {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

html.dark-mode .view-toggle .btn:hover {
    background: var(--bg-tertiary);
}

html.dark-mode .view-toggle .btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}