/* Custom CSS for Classified Ads Website */

:root {
    --primary-color: #fb1318; /* Brand red */
    --primary-color-dark: #c20f13; /* Darker red */
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #0f172a; /* Slate-900 for stronger contrast */
    --border-radius: 10px;
    --box-shadow: 0 10px 25px rgba(0,0,0,0.08), 0 3px 8px rgba(0,0,0,0.06);
    --transition: all 0.3s ease;
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #ffffff;
}

/* Navigation */
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-light .navbar-toggler { border: none; }
.navbar-light .navbar-toggler:focus { box-shadow: none; }
.navbar-light .navbar-toggler-icon { filter: hue-rotate(320deg) saturate(160%); }

.dropdown-menu {
    border: 0;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.12);
    padding: 10px;
    transform-origin: top;
}
.dropdown-item { border-radius: 8px; }
.dropdown-item:hover { background: #fef2f2; color: var(--primary-color); }

.navbar-nav .nav-link {
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0.2rem;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.25s ease;
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    width: 100%;
}

/* Primary text/link override */
.text-primary { color: var(--primary-color) !important; }
.link-primary { color: var(--primary-color) !important; }

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.btn-light { background: #fff; border: 1px solid #f1f5f9; }
.btn-light:hover { background: #fff; box-shadow: 0 8px 22px rgba(15,23,42,0.08); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-color-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(251,19,24,0.35);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
    transform-style: preserve-3d;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
    transition: var(--transition);
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

/* 3D tilt depth for titles */
.card .card-title { will-change: transform; }

/* Listing Cards */
.listing-card {
    position: relative;
    overflow: hidden;
}

.listing-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    box-shadow: 0 6px 14px rgba(251,19,24,0.25);
}

.listing-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success-color);
}

.listing-location {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.listing-views {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    color: white;
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

/* Carousel controls recolor for red theme */
.carousel-control-prev-icon,
.carousel-control-next-icon {
    filter: invert(22%) sepia(96%) saturate(3569%) hue-rotate(327deg) brightness(95%) contrast(92%);
}

/* Horizontal listing slider */
.listing-slider {
    position: relative;
}
.listing-slider .slider-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
}
.listing-slider .slider-item {
    min-width: 260px;
    scroll-snap-align: start;
}
.listing-slider .nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15,23,42,0.8);
    color: #fff;
    border: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.listing-slider .nav-btn.prev { left: -10px; }
.listing-slider .nav-btn.next { right: -10px; }

@media (max-width: 576px) {
    .listing-slider .slider-item { min-width: 220px; }
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
}

/* Search Form */
.search-form {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-top: -50px;
    position: relative;
    z-index: 3;
}

.search-suggestions {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-top: 8px;
    width: 100%;
    box-shadow: var(--box-shadow);
    max-height: 260px;
    overflow-y: auto;
    z-index: 30;
}

.suggestion-item { padding: 10px 14px; cursor: pointer; }
.suggestion-item:hover { background: #fafafa; color: var(--primary-color); }

/* Categories Grid */
.category-card {
    text-align: center;
    padding: 30px 20px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: white;
    border: 2px solid transparent;
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
}

.category-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Stats Section */
.stats-section {
    background: var(--light-color);
    padding: 60px 0;
}

.stat-item {
    text-align: center;
    padding: 20px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    color: var(--secondary-color);
    font-weight: 500;
}

/* Footer */
footer {
    background: var(--dark-color) !important;
}

footer a {
    transition: var(--transition);
}

footer a:hover {
    color: var(--primary-color) !important;
}

/* Footer text/readability overrides */
footer,
footer p,
footer li,
footer .contact-info,
footer .list-unstyled li a {
    color: rgba(255,255,255,0.9) !important;
}
footer h5,
footer h6 { color: #fff !important; }
footer .text-muted { color: rgba(255,255,255,0.75) !important; }
footer .btn-outline-light { color: #fff; border-color: rgba(255,255,255,0.5); }
footer .btn-outline-light:hover { background: rgba(255,255,255,0.15); color: #fff; }

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

/* Footer newsletter */
.footer-newsletter .footer-input { border: 0; border-radius: 10px; }
.footer-newsletter form { align-items: center; }
.payment-icons i { color: #cbd5e1; }
.app-badges .btn { border-color: rgba(255,255,255,0.35); color: #fff; }
.app-badges .btn:hover { background: rgba(255,255,255,0.15); }

/* Footer newsletter input theming for dark background */
.footer-newsletter .footer-input {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.footer-newsletter .footer-input::placeholder {
    color: rgba(255,255,255,0.6);
}

/* Forms */
.form-control {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(251,19,24,0.25);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
}

/* Image Gallery */
.image-gallery {
    position: relative;
}

.gallery-main {
    height: 400px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #0b0b0b;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    overflow-x: auto;
}

.gallery-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.gallery-thumbnail:hover,
.gallery-thumbnail.active {
    border-color: var(--primary-color);
    box-shadow: 0 6px 14px rgba(251,19,24,0.25);
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* User Profile */
.profile-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    color: white;
    padding: 40px 0;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
    object-fit: cover;
}

/* Dashboard */
.dashboard-card {
    border-left: 4px solid var(--primary-color);
}

.dashboard-stat {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.dashboard-stat-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0;
    }
    
    .search-form {
        margin-top: -30px;
        padding: 20px;
    }
    
    .category-icon {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .gallery-main {
        height: 250px;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .card-img-top {
        height: 150px;
    }
    
    .gallery-thumbnail {
        width: 60px;
        height: 60px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Back to top button */
#backToTop {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color-dark);
}

/* Minimal glass/3D accents */
.navbar {
    backdrop-filter: saturate(160%) blur(8px);
    -webkit-backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.search-form {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.6);
}

.badge.bg-primary { background-color: var(--primary-color) !important; }

/* Elevation tweaks for stronger 3D feel */
.card:hover {
    box-shadow: 0 18px 35px rgba(0,0,0,0.12), 0 8px 14px rgba(0,0,0,0.08);
}

/* Promo overlay/chips */
.promo-overlay {
    position: relative;
}
.promo-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.promo-chip { background: #fef2f2; color: var(--primary-color); padding: 6px 10px; border-radius: 999px; font-weight: 600; font-size: 0.85rem; }

/* Brand strip */
.brand-strip { background: #fff; border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; padding: 16px 0; }
.brand-logos { display: flex; align-items: center; gap: 26px; justify-content: center; flex-wrap: wrap; }
.brand-logo { width: 100px; height: 28px; background: #f3f4f6; border-radius: 6px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.06); }

/* Sticky sidebar */
.sticky-sidebar { position: sticky; top: 90px; }

/* Icon tiles */
.icon-tile { background: #fff; border: 1px solid #f1f5f9; border-radius: 14px; padding: 22px; text-align: center; transition: transform .2s ease, box-shadow .2s ease; }
.icon-tile:hover { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(0,0,0,0.10); }
.icon-tile .icon { font-size: 28px; color: var(--primary-color); margin-bottom: 10px; }

/* Ghost button */
.btn-ghost { background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.35); }
.btn-ghost:hover { background: rgba(255,255,255,0.3); color: #fff; }

/* Breadcrumbs */
.breadcrumb {
    background: transparent;
    margin-bottom: 1rem;
}
.breadcrumb .breadcrumb-item a { color: var(--primary-color); text-decoration: none; }
.breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: #cbd5e1; }

/* Pagination */
.pagination .page-link {
    border: none;
    color: var(--dark-color);
    margin: 0 4px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.pagination .page-link:hover { color: var(--primary-color); }
.pagination .page-item.active .page-link {
    background: var(--primary-color);
    color: #fff;
}

/* Tables */
.table { border-collapse: separate; border-spacing: 0 8px; }
.table thead th { border: none; color: #64748b; font-weight: 600; }
.table tbody tr { background: #fff; box-shadow: var(--box-shadow); }
.table tbody td { border: none; }

/* Blog cards */
.card .card-text { color: #64748b; }
.card .card-footer { background: #fff; border-top: 1px solid #f1f5f9; }

/* Elevation utilities */
.shadow-3d { box-shadow: 0 16px 32px rgba(0,0,0,0.12), 0 6px 12px rgba(0,0,0,0.08); }
.elevate-on-hover:hover { transform: translateY(-6px); box-shadow: 0 22px 45px rgba(0,0,0,0.16); }

/* Alerts */
.alert { border: 0; border-radius: 12px; box-shadow: 0 12px 28px rgba(0,0,0,0.10); }

/* Modals */
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,0.22); }
.modal-header { border-bottom: 1px solid #f1f5f9; }
.modal-footer { border-top: 1px solid #f1f5f9; }

/* Badges */
.badge { border-radius: 999px; padding: 0.4rem 0.6rem; }
.badge.bg-danger { background-color: var(--primary-color) !important; }

/* Card ribbons (e.g., featured/urgent) */
.ribbon {
    position: absolute; top: 14px; right: -10px; z-index: 3;
    background: var(--primary-color); color: #fff; padding: 6px 14px;
    transform: rotate(10deg); border-radius: 6px;
}

/* Ecommerce-like price emphasis */
.price-lg { font-size: 1.35rem; font-weight: 800; color: var(--primary-color); }

/* Table dense variant */
.table-dense tbody tr td { padding: 0.55rem 0.75rem; }

/* Chips/Tags */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fef2f2;
    color: var(--primary-color);
    font-size: 0.85rem;
}

/* Print styles */
@media print {
    .navbar,
    footer,
    .btn,
    #backToTop {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
    }
}
