/* ==========================================================================
   Brands Section - Bogura Bazar Theme (Modern & Premium Design)
   Version: 4.0
   ========================================================================== */

.brands-product-section {
    margin: 50px 0;
    padding: 35px 25px;
    background: linear-gradient(180deg, #ffffff 0%, #fcfdfe 100%);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.02);
    border: 1px solid #f8fafc;
}

/* ========== Slider Container ========== */
.brands-slider-container {
    position: relative;
    padding: 5px 0;
}

/* ========== Slider Track ========== */
.brands-slider-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 5px 25px 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    scroll-snap-type: x mandatory;
}

.brands-slider-track::-webkit-scrollbar {
    display: none; /* Chrome & Safari */
}

/* ========== Brand Item ========== */
.brand-item {
    flex: 0 0 auto;
    width: 180px;
    scroll-snap-align: start;
}

/* ========== Brand Card ========== */
.brand-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    background: var(--white);
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
    overflow: hidden;
    height: 100%;
    position: relative;
}

.brand-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 35px rgba(0, 166, 90, 0.15);
    border-color: rgba(0, 166, 90, 0.25);
}

/* ========== Brand Logo ========== */
.brand-logo {
    width: 100%;
    height: 130px;
    margin: 0;
    padding: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.brand-img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.02));
}

.brand-card:hover .brand-img {
    transform: scale(1.08);
}

.brand-logo-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.brand-icon {
    font-size: 40px;
    color: #cbd5e1;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-card:hover .brand-icon {
    color: var(--primary-light);
    transform: scale(1.1);
}

/* ========== Hover Overlay ========== */
.brand-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 166, 90, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.brand-card:hover .brand-card-overlay {
    opacity: 1;
}

.brand-visit-btn {
    width: 38px;
    height: 38px;
    background: var(--primary-light);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transform: scale(0.6) translateY(10px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 166, 90, 0.3);
}

.brand-card:hover .brand-visit-btn {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ========== Brand Info ========== */
.brand-info {
    text-align: center;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    background: #ffffff;
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.brand-card:hover .brand-name {
    color: var(--primary-light);
}

.brand-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    background: rgba(0, 166, 90, 0.06);
    color: var(--primary-light);
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 166, 90, 0.02);
}

.brand-count i {
    font-size: 10px;
}

.brand-card:hover .brand-count {
    background: var(--primary-light);
    color: #ffffff;
    border-color: var(--primary-light);
}

/* ========== Slider Buttons ========== */
.brand-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    color: #64748b;
}

.brand-slider-btn i {
    transition: transform 0.2s ease;
}

.brand-slider-btn:hover {
    background: var(--primary-light);
    color: #ffffff;
    border-color: var(--primary-light);
    box-shadow: 0 10px 20px rgba(0, 166, 90, 0.25);
    transform: translateY(-50%) scale(1.08);
}

.brand-slider-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.brand-slider-btn:disabled {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.brand-slider-prev {
    left: -22px;
}

.brand-slider-prev:hover i {
    transform: translateX(-2px);
}

.brand-slider-next {
    right: -22px;
}

.brand-slider-next:hover i {
    transform: translateX(2px);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1199px) {
    .brands-product-section {
        padding: 30px 20px;
        margin: 40px 0;
    }
    .brand-item {
        width: 170px;
    }
    .brand-slider-prev {
        left: -15px;
    }
    .brand-slider-next {
        right: -15px;
    }
}

@media (max-width: 1023px) {
    .brands-product-section {
        padding: 25px 15px;
    }
    .brand-item {
        width: 150px;
    }
    .brand-logo {
        height: 115px;
        padding: 12px;
    }
    .brand-slider-prev {
        left: -8px;
    }
    .brand-slider-next {
        right: -8px;
    }
}

@media (max-width: 767px) {
    .brands-product-section {
        margin: 30px 0;
        padding: 20px 12px;
        border-radius: 18px;
    }
    .brand-item {
        width: 135px;
        gap: 12px;
    }
    .brand-logo {
        height: 100px;
        padding: 10px;
    }
    .brand-name {
        font-size: 13px;
        margin-bottom: 6px;
    }
    .brand-count {
        font-size: 10px;
        padding: 3px 10px;
    }
    .brand-slider-btn {
        display: none; /* Enable swipe gesture purely on mobile */
    }
    .brands-slider-track {
        padding-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .brands-product-section {
        margin: 20px 0;
        padding: 15px 8px;
        border-radius: 12px;
    }
    .brand-item {
        width: 120px;
    }
    .brand-logo {
        height: 85px;
        padding: 8px;
    }
    .brand-info {
        padding: 12px 8px;
    }
    .brand-name {
        font-size: 12px;
    }
    .brand-count {
        font-size: 9px;
        padding: 2px 8px;
    }
}

/* ========== Hover Optimization for Touch Devices ========== */
@media (hover: none) and (pointer: coarse) {
    .brand-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
        border-color: var(--border-color);
    }
    .brand-card:hover .brand-img {
        transform: none;
    }
    .brand-card:hover .brand-name {
        color: var(--text-dark);
    }
    .brand-card:hover .brand-count {
        background: rgba(0, 166, 90, 0.06);
        color: var(--primary-light);
        border-color: rgba(0, 166, 90, 0.02);
    }
    .brand-card-overlay {
        display: none;
    }
}
