/* ===================================
   B2B Premium Theme - Alibaba Style
   Colors: Custom Primary & Secondary
   =================================== */

:root {
    /* Color Palette - Updated */
    --bs-primary: #f46e12;
    /* New Primary Color */
    --bs-primary-rgb: 244, 110, 18;
    --bs-secondary: #0c4caa;
    /* New Secondary Color */
    --bs-secondary-rgb: 12, 76, 170;
    --accent-color: #f57b2a;
    /* Slightly lighter shade of primary for accent */
    --accent-color-rgb: 245, 123, 42;
    --bs-body-bg: #f4f4f4;
    /* Light Background (unchanged) */
    --bs-body-color: #333333;

    /* Typography */
    --font-heading: 'Tajawal', sans-serif;
    --font-body: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

@media (max-width: 991px) {
    body {
        padding-bottom: 70px;
        /* Space for bottom nav */
    }
}

.text-primary {
    color: var(--bs-primary) !important;
}

.bg-primary {
    background-color: var(--bs-primary) !important;
}

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    background-color: #d8620f;
    border-color: #d8620f;
}

.text-accent {
    color: var(--accent-color) !important;
}

.bg-accent {
    background-color: var(--accent-color) !important;
}

/* ===================================
   Navbar & Mega Menu
   =================================== */
.navbar {
    background-color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Mobile navbar layout for RTL */
@media (max-width: 991px) {
    .navbar>.container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
    }

    /* Logo stays on the right */
    .navbar-brand {
        order: 0;
        margin-left: auto;
    }

    /* Toggler button on the right side */
    .navbar-toggler {
        order: 1;
        margin-right: 0;
        margin-left: 1rem;
    }

    /* Dropdown menu appears from right */
    .navbar-collapse {
        position: absolute !important;
        top: 100% !important;
        right: 0 !important;
        left: auto !important;
        background: white !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        padding: 1rem !important;
        border-radius: 0 0 8px 8px !important;
        z-index: 1000 !important;
        width: 100% !important;
        max-width: 350px !important;
        order: 2;
    }

    .navbar-collapse.show,
    .navbar-collapse.collapsing {
        right: 0 !important;
        left: auto !important;
    }
}

.navbar-brand {
    color: var(--bs-primary) !important;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    color: #0c4caa !important;
    /* Updated to new secondary */
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 1rem;
}

.nav-link:hover {
    color: var(--bs-primary) !important;
    background-color: rgba(244, 110, 18, 0.05);
}

.nav-link .badge {
    position: absolute;
    top: 5px;
    right: auto;
    left: 0;
    transform: translate(-50%, -50%);
}

/* RTL Support for Badge */
[dir="rtl"] .nav-link .badge {
    left: auto;
    right: 0;
    transform: translate(50%, -50%);
}

.nav-link:hover,
.nav-link.active {
    color: var(--bs-primary) !important;
}

/* Desktop Animation */
@media (min-width: 992px) {
    .dropdown-menu.fade-up {
        animation: fadeUp 0.3s ease forwards;
        display: block;
        opacity: 0;
        visibility: hidden;
        top: 110%;
    }

    .dropdown:hover .dropdown-menu.fade-up {
        opacity: 1;
        visibility: visible;
        top: 100%;
    }

    @keyframes fadeUp {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Mobile Menu Tweaks */
@media (max-width: 991px) {
    .dropdown-menu.mega-menu {
        border: none;
        padding: 0 1rem;
        background: transparent;
    }
}

/* Mega Menu Support */
@media (min-width: 992px) {
    .dropdown-menu.mega-menu {
        width: 100%;
        left: 0;
        right: 0;
        margin-top: 0;
        border: none;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        padding: 2rem;
        background: #fff;
    }

    .navbar-expand-lg .navbar-nav .nav-item {
        position: static;
    }
}

.mega-menu-heading {
    color: var(--bs-secondary);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bs-primary);
    display: inline-block;
}

.mega-menu-link {
    display: block;
    padding: 0.5rem 0;
    color: #666666;
    text-decoration: none;
    transition: all 0.2s;
}

.mega-menu-link:hover {
    color: var(--bs-primary);
    transform: translateX(-5px);
}

/* ===================================
   Premium Product Cards
   =================================== */
.card {
    border: 1px solid #e5e5e5;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
}

@media (min-width: 992px) {
    .product-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        border-color: var(--bs-primary);
    }
}

.card-img-wrapper {
    position: relative;
    width: 100%;
    height: 184px;
    overflow: hidden;
    background: #ffffff;
    border-bottom: 1px solid #f0f0f0;
}

@media (max-width: 768px) {
    .card-img-wrapper {
        height: 143px;
    }
}

.card-img-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 0;
    transition: transform 0.5s ease;
}

@media (min-width: 992px) {
    .product-card:hover .card-img-top {
        transform: scale(1.08);
    }
}

.badge {
    font-weight: 500;
    padding: 0.4em 0.7em;
    border-radius: 4px;
    z-index: 10;
}

.badge-new {
    background-color: var(--bs-primary);
    color: white;
}

.badge-sale {
    background-color: #ffe8d6;
    color: var(--bs-primary);
    border: 1px solid var(--bs-primary);
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.card-text {
    color: #757575;
    font-size: 0.9rem;
}

.price-box {
    margin-top: auto;
    padding-top: 1rem;
}

.price-current {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0c4caa;
    /* Updated to new secondary */
}

.price-old {
    color: #999;
    text-decoration: line-through;
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

/* Hover Action Button - Updated for Mobile & Desktop */
.card-actions {
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

/* For Desktop - Show on hover */
@media (min-width: 992px) {
    .product-card:hover .card-actions {
        opacity: 1;
        transform: translateY(0);
    }
}

/* For Mobile - Show on touch/tap */
@media (max-width: 991px) {
    .card-actions {
        opacity: 0 !important;
        visibility: hidden;
        transform: translateY(10px);
        transition: all 0.3s ease;
    }

    .product-card.mobile-active .card-actions {
        opacity: 1 !important;
        visibility: visible;
        transform: translateY(0);
    }

    /* Add touch-friendly styling */
    .product-card {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .card-actions {
        padding-bottom: 0.5rem;
    }
}

/* ===================================
   Footer & Buttons
   =================================== */
.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(244, 110, 18, 0.15);
}

/* ===================================
   Skeleton Loading
   =================================== */
.skeleton {
    background-color: #eeeeee;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.3) 20%,
            rgba(255, 255, 255, 0.6) 60%,
            rgba(255, 255, 255, 0));
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.card-img-wrapper.skeleton img {
    opacity: 0;
}

.card-img-wrapper.loaded img {
    opacity: 1;
}

/* ===================================
   Category Sidebar
   =================================== */
.sidebar-filters .list-group {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-filters .list-group::-webkit-scrollbar {
    width: 6px;
}

.sidebar-filters .list-group::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-filters .list-group::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ===================================
   Professional Brand Scroller
   =================================== */
.brand-scroller {
    display: flex;
    overflow-x: auto;
    gap: 1.5rem;
    padding: 1rem 0;
    scrollbar-width: none;
    /* Hide for Firefox */
}

.brand-scroller::-webkit-scrollbar {
    display: none;
    /* Hide for Chrome/Safari */
}

.brand-item {
    flex: 0 0 auto;
    width: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    opacity: 0.8;
}

@media (min-width: 992px) {
    .brand-item:hover {
        opacity: 1;
    }
}

.brand-item.active {
    opacity: 1;
}

.brand-logo-circle {
    width: 75px;
    height: 75px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
}

.brand-item.active .brand-logo-circle {
    border-color: var(--bs-primary);
    box-shadow: 0 0 10px rgba(244, 110, 18, 0.1);
}

.brand-logo-img {
    max-width: 70%;
    filter: grayscale(100%);
}

@media (min-width: 992px) {
    .brand-item:hover .brand-logo-img {
        filter: grayscale(0%);
    }
}

.brand-item.active .brand-logo-img {
    filter: grayscale(0%);
}

.brand-name {
    font-size: 0.85rem;
    color: #333;
    font-weight: 500;
}

.brand-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--bs-primary);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

/* ===================================
   Mobile Product Card Activation
   =================================== */
/* Mobile Product Card Activation - Animations Disabled per Request */
.product-card.mobile-active {
    /* transform: translateY(-3px); */
    /* Disabled */
    /* box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1); */
    /* Disabled */
    border-color: var(--bs-primary);
}

.product-card.mobile-active .card-img-top {
    transform: none;
}

/* Restore Number Input Spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: inner-spin-button !important;
    opacity: 1 !important;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}