/* Cloud Buy Or Sell - Modern E-commerce Stylesheet (Optimized & Responsive) */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #E63946;
    --dark-red: #C1121F;
    --accent-gold: #FFD166;
    --primary-color: #E63946;
    --secondary-color: #FFD166;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --border-gray: #e5e5e5;
    --dark-gray: #333333;
    --border-radius: 14px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --container-padding: 1rem;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    background: #f4f6f9;
    color: var(--dark-gray);
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* ============ CONTAINER FIXES ============ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

[class*="col-"] {
    padding: 0 0.5rem;
}

/* ============ HEADER / NAVIGATION BAR ============ */
.navbar {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    width: 100%;
}

.navbar > .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.navbar-brand {
    color: var(--white) !important;
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

/* Mobile Menu Toggle Button */
.navbar-toggler {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

.navbar-toggler i {
    color: var(--white);
    font-size: 1.5rem;
}

/* Navigation Links - Desktop */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-nav .nav-link {
    color: var(--white) !important;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 50px;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

/* ============ SEARCH BAR ============ */
.navbar-search-form {
    flex: 1;
    min-width: 200px;
    max-width: 500px;
}

.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--white);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
}

.search-box button {
    background: var(--accent-gold);
    border: none;
    padding: 0.7rem 1.2rem;
    cursor: pointer;
    color: #212121;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

/* Top Right Icons */
.navbar-icons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-icon-link {
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem;
    border-radius: 50px;
    white-space: nowrap;
}

.navbar-icon-link i {
    font-size: 1.2rem;
}

.navbar-icon-link span:not(.cart-badge) {
    display: inline-block;
}

/* Cart Badge */
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ff6b6b, var(--danger-color));
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 0 4px;
}

/* Category Menu Bar */
.navbar-category-menu {
    background: var(--white);
    border-top: 1px solid var(--border-gray);
    border-bottom: 1px solid var(--border-gray);
    box-shadow: var(--shadow-sm);
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.category-menu-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
}

.category-menu-item {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-right: 1px solid #f0f0f0;
}

.category-menu-link {
    color: #212121;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.category-menu-link i {
    font-size: 0.9rem;
    color: var(--primary-red);
}

/* ============ HERO / CAROUSEL SECTION ============ */
.carousel {
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.carousel-inner {
    border-radius: inherit;
}

.carousel-item img {
    width: 100%;
    height: auto;
    min-height: 200px;
    max-height: 400px;
    object-fit: cover;
}

.carousel-caption {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.6), transparent);
    border-radius: var(--border-radius);
    padding: 1rem;
}

/* ============ SECTION HEADERS ============ */
.section-header {
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
}

.section-header .section-subtitle {
    font-size: 0.85rem;
    color: #777;
}

/* ============ PRODUCT CARDS - FULLY FIXED ============ */
.products-section {
    background: var(--white);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Tablet */
@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.2rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    .products-section {
        padding: 2rem;
        margin-bottom: 2rem;
    }
}

/* ============ MODERN AMAZON-STYLE PRODUCT SLIDER ============ */
.product-slider-section {
    background: var(--white);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.slider-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.slider-controls {
    display: flex;
    gap: 0.5rem;
}

/* Slider Wrapper */
.product-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.product-slider {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding: 0.5rem 0;
    -webkit-overflow-scrolling: touch;
}

.product-slider::-webkit-scrollbar {
    display: none;
}

/* Slider Product Card */
.product-slider .product-card {
    flex: 0 0 auto;
    width: 200px;
    scroll-snap-align: start;
}

/* Mobile: smaller cards */
@media (max-width: 640px) {
    .product-slider .product-card {
        width: 160px;
    }
}

/* Desktop: larger cards */
@media (min-width: 1024px) {
    .product-slider .product-card {
        width: 220px;
    }
}

/* Slider Navigation Buttons */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: var(--white);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
}

.slider-btn:hover {
    transform: translateY(-50%) scale(1.1);
    background: linear-gradient(135deg, var(--dark-red), var(--primary-red));
    box-shadow: var(--shadow-md);
}

.slider-btn.prev {
    left: -12px;
}

.slider-btn.next {
    right: -12px;
}

@media (max-width: 768px) {
    .slider-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    .slider-btn.prev {
        left: -8px;
    }
    .slider-btn.next {
        right: -8px;
    }
}

/* Product Card Styles (consistent across all sections) */
.product-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
    box-shadow: var(--shadow-sm);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-red);
}

.product-image {
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 2;
}

.product-badge.badge-new {
    background: linear-gradient(135deg, #28c76f, #00b894);
}

.product-card-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-gray);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.4rem;
}

.product-category {
    font-size: 0.7rem;
    color: var(--primary-red);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    font-weight: 600;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.product-price-current {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-red);
}

.product-price-old {
    font-size: 0.75rem;
    color: #aaa;
    text-decoration: line-through;
}

.product-discount {
    background: rgba(40, 167, 69, 0.12);
    color: #28a745;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
}

.product-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn-add-cart {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: white;
    border: none;
    padding: 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-cart:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-view-details {
    flex: 1;
    background: white;
    color: var(--primary-red);
    border: 1.5px solid var(--primary-red);
    padding: 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-view-details:hover {
    background: var(--primary-red);
    color: white;
}

@media (min-width: 768px) {
    .product-card-body {
        padding: 1rem;
    }
    .product-name {
        font-size: 0.95rem;
        min-height: 2.6rem;
    }
    .product-price-current {
        font-size: 1.25rem;
    }
    .btn-add-cart,
    .btn-view-details {
        padding: 0.7rem;
        font-size: 0.75rem;
    }
}

/* ============ CATEGORY CARDS ============ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.category-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.category-card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--white);
}

.category-card-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.5rem;
}

.category-card a {
    text-decoration: none;
    color: var(--accent-gold);
    font-size: 0.7rem;
    font-weight: 600;
}

/* ============ POPULAR CATEGORIES ============ */
.popular-category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .popular-category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.popular-category-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    aspect-ratio: 1 / 1;
}

.popular-category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.popular-category-card .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: #fff;
}

.popular-category-card h5 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
}

.popular-category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.popular-category-card:hover img {
    transform: scale(1.08);
}

/* ============ PROMOTIONAL BANNERS ============ */
.banners-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .banners-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .banners-section {
        grid-template-columns: repeat(3, 1fr);
    }
}

.promo-banner {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    min-height: 200px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.promo-banner:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.promo-banner.beauty {
    background: linear-gradient(135deg, #FF1493, #FF69B4);
}

.promo-banner.deals {
    background: linear-gradient(135deg, #FF8C00, #FFD700);
}

.promo-banner.fresh {
    background: linear-gradient(135deg, #00b894, #55efc4);
}

.promo-content {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--white);
}

.promo-content h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.promo-content p {
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.promo-btn {
    background: var(--white);
    color: var(--dark-gray);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    width: fit-content;
    transition: var(--transition);
}

/* ============ BRANDS CAROUSEL ============ */
.brands-section {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.brands-carousel {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 1rem 0;
    -webkit-overflow-scrolling: touch;
}

.brands-carousel::-webkit-scrollbar {
    display: none;
}

.brand-item {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

@media (min-width: 640px) {
    .brand-item {
        width: 100px;
        height: 100px;
    }
}

.brand-item i {
    font-size: 2rem;
}

.brand-item-name {
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    margin-top: 0.3rem;
}

/* ============ CTA SECTION ============ */
.cta-section {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2rem 1.5rem;
    border-radius: 20px;
    text-align: center;
    margin: 1.5rem 0;
}

.cta-section h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.cta-section p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.cta-section .btn {
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    color: #212121;
    padding: 0.7rem 1.5rem;
    font-weight: 700;
    border-radius: 50px;
    text-decoration: none;
    display: inline-block;
}

@media (min-width: 768px) {
    .cta-section {
        padding: 3rem 2rem;
    }
    .cta-section h2 {
        font-size: 2rem;
    }
}

/* ============ FOOTER ============ */
footer {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    padding: 2rem 0 1rem;
    margin-top: 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

footer h5 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--accent-gold);
}

footer ul {
    list-style: none;
    padding: 0;
}

footer ul li {
    margin-bottom: 0.5rem;
}

footer a {
    color: #bdbdbd;
    text-decoration: none;
    font-size: 0.8rem;
    transition: var(--transition);
}

/* ============ MOBILE RESPONSIVE FIXES ============ */
@media (max-width: 768px) {
    :root {
        --container-padding: 0.75rem;
    }
    
    /* Mobile Navigation */
    .navbar-toggler {
        display: block;
    }
    
    .navbar-collapse {
        display: none;
        width: 100%;
        flex-direction: column;
    }
    
    .navbar-collapse.show {
        display: flex;
    }
    
    .navbar-nav {
        flex-direction: column;
        width: 100%;
        margin-top: 0.75rem;
    }
    
    .navbar-nav .nav-link {
        width: 100%;
        text-align: center;
        padding: 0.6rem;
    }
    
    .navbar-search-form {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 0.75rem;
    }
    
    .search-box input {
        padding: 0.6rem 0.8rem;
    }
    
    .search-box button {
        padding: 0.6rem 1rem;
    }
    
    .navbar-icons {
        gap: 0.5rem;
    }
    
    .navbar-icon-link span:not(.cart-badge) {
        display: none;
    }
    
    .navbar-icon-link {
        padding: 0.4rem;
    }
    
    /* Hero fixes */
    .carousel-caption {
        display: none !important;
    }
    
    /* Category menu horizontal scroll */
    .navbar-category-menu {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .category-menu-list {
        display: inline-flex;
        width: auto;
    }
    
    /* Section spacing */
    .section-header {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .section-header h2 {
        font-size: 1.25rem;
    }
}

/* Tablet responsive */
@media (min-width: 769px) and (max-width: 1023px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-icon-link span:not(.cart-badge) {
        display: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop improvements */
@media (min-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .product-card-actions {
        flex-direction: row;
    }
}

/* ============ UTILITY CLASSES ============ */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============ PERFORMANCE OPTIMIZATIONS ============ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.product-card,
.category-card,
.promo-banner,
.brand-item {
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}