:root {
    --bg-primary: #f4f7fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --accent: #22d9c4;
    --accent-hover: #1ab8a6;
    --accent-light: #007aff;
    --accent-secondary: #2563eb;
    --sale: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 2px 12px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); }

/* Header */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.site-header .navbar {
    padding: 10px 0;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary) !important;
    font-weight: 700;
    font-size: 1.15rem;
    flex-shrink: 0;
    padding: 0;
}

.brand-logo {
    display: block;
    height: 40px;
    width: auto;
    max-width: 180px;
}

.brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

.main-nav {
    flex-wrap: nowrap;
}

.navbar-nav .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 8px 12px !important;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: color 0.2s;
}

.navbar-nav .nav-link:hover { color: var(--text-primary) !important; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-actions .search-form {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 220px;
}

.header-actions .search-form input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 25px;
    padding: 8px 40px 8px 16px;
    width: 100%;
    font-size: 0.88rem;
    height: 40px;
}

.header-actions .search-form button {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.login-link,
.cart-link,
.user-link {
    color: var(--text-primary);
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    border: none;
    background: none;
    padding: 0;
    line-height: 1;
}

.login-link span {
    font-size: 0.9rem;
    font-weight: 500;
}

.user-link {
    max-width: 160px;
    font-size: 0.9rem;
    font-weight: 500;
}

.user-link::after {
    margin-right: 4px;
}

.user-link-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100px;
}

.user-link i {
    font-size: 1.35rem;
    flex-shrink: 0;
}

.header-user .dropdown-menu {
    min-width: 220px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.header-user .dropdown-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 12px;
    white-space: normal;
    word-break: break-word;
}

.header-user .dropdown-item {
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-user .dropdown-item i {
    color: var(--text-muted);
    width: 18px;
}

.cart-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background: var(--sale);
    color: white;
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-toggler {
    border-color: var(--border);
    padding: 6px 10px;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 122, 255, 0.15);
}

@media (min-width: 992px) {
    .site-header .navbar-collapse {
        display: flex !important;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .main-nav {
        flex: 1 1 auto;
        justify-content: center;
        min-width: 0;
        overflow: hidden;
    }
}

@media (max-width: 991.98px) {
    .site-header .navbar-collapse {
        padding-top: 12px;
        border-top: 1px solid var(--border);
        margin-top: 10px;
    }

    .header-actions {
        width: 100%;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
        flex-wrap: wrap;
    }

    .header-actions .search-form {
        width: 100%;
        max-width: none;
        order: 3;
        margin-top: 4px;
    }

    .user-link-name {
        max-width: none;
    }

    .navbar-nav .nav-link {
        padding: 10px 4px !important;
    }
}

@media (max-width: 1199.98px) and (min-width: 992px) {
    .user-link-name {
        display: none;
    }

    .navbar-nav .nav-link {
        padding: 8px 8px !important;
        font-size: 0.85rem;
    }

    .header-actions .search-form {
        max-width: 160px;
    }
}

/* Hero Slider */
.hero-slider { margin-bottom: 0; }

.hero-slide {
    height: 400px;
    background-size: cover;
    background-position: center;
    border-radius: 0 0 var(--radius) var(--radius);
}

.carousel-control-prev, .carousel-control-next {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
}

.carousel-indicators [data-bs-target] {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Sections */
.section { padding: 50px 0; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.section-subtitle { color: var(--text-secondary); margin: 0; }

.view-more {
    color: var(--accent-light);
    font-size: 0.9rem;
}

/* Category Cards */
.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #007aff, #22d9c4);
    border-radius: var(--radius);
    padding: 20px 10px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    color: white;
    height: 100%;
    box-shadow: var(--shadow-sm);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.25);
    color: white;
}

.category-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
}

.category-icon img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.category-name { font-size: 0.85rem; font-weight: 500; line-height: 1.4; }

/* Product Cards */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.product-image {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f8fafc;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img { transform: scale(1.05); }

.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--sale);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
}

.product-info { padding: 16px; flex-grow: 1; display: flex; flex-direction: column; }

.product-category {
    font-size: 0.75rem;
    color: var(--accent-light);
    margin-bottom: 4px;
}

.product-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 10px;
    line-height: 1.5;
    flex-grow: 1;
}

.product-title a { color: var(--text-primary); }
.product-title a:hover { color: var(--accent-light); }

.product-price { margin-bottom: 12px; }

.old-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 8px;
}

.current-price {
    color: var(--accent-secondary);
    font-weight: 700;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-secondary));
    border: none;
    color: #fff;
}

/* Brand Cards */
.brand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
    color: var(--text-primary);
    height: 100%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.brand-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.brand-logo {
    width: 100%;
    height: 48px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    padding: 6px 10px;
    border: 1px solid var(--border);
}

.brand-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brand-name { font-size: 0.85rem; }

.brand-card-lg {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    color: var(--text-primary);
    transition: all 0.2s;
}

.brand-card-lg:hover { background: var(--bg-card-hover); color: var(--text-primary); transform: translateY(-2px); }

.brand-logo-lg {
    width: 100%;
    max-width: 140px;
    height: 56px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    padding: 8px 12px;
    border: 1px solid var(--border);
}

.brand-logo-lg img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Page Header */
.page-header {
    background: var(--bg-secondary);
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.page-header h1 { font-size: 1.8rem; font-weight: 700; margin: 0; }

/* Filter Panel */
.filter-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
}

.filter-panel h5 { margin-bottom: 20px; }

.filter-panel .form-control,
.filter-panel .form-select {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}

/* Product Detail */
.product-detail-image img { width: 100%; background: var(--bg-card); }

.product-detail-info h1 { font-size: 1.6rem; font-weight: 700; margin: 10px 0 20px; }

.product-brand { color: var(--accent-light); font-size: 0.9rem; }

.product-price-lg .current-price { font-size: 1.5rem; }

.discount-badge-lg {
    background: var(--sale);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
    margin-bottom: 10px;
}

.quantity-input {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.qty-btn {
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
}

.quantity-input input {
    width: 50px;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
}

.content-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    line-height: 1.8;
}

/* Cart */
.cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.cart-item-info { flex-grow: 1; }
.cart-item-info h4 { font-size: 0.95rem; margin: 0 0 4px; }

.cart-summary, .checkout-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.summary-row.total { font-weight: 700; font-size: 1.1rem; }

.summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

/* Auth */
.auth-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
}

.auth-box h2 { text-align: center; margin-bottom: 30px; }

/* Forms */
.form-control, .form-select {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.form-control:focus, .form-select:focus {
    background: var(--bg-secondary);
    border-color: var(--accent-light);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 122, 255, 0.15);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 4rem; margin-bottom: 20px; display: block; }

/* Success */
.success-box i { font-size: 5rem; margin-bottom: 20px; }

/* Footer */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 50px 0 20px;
    margin-top: 50px;
}

.footer-brand {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.footer-desc { color: var(--text-secondary); font-size: 0.9rem; }

.site-footer h6 { font-weight: 600; margin-bottom: 15px; }

.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: var(--text-secondary); font-size: 0.9rem; }
.footer-links a:hover { color: var(--text-primary); }

.footer-contact { list-style: none; padding: 0; }
.footer-contact li { margin-bottom: 10px; color: var(--text-secondary); font-size: 0.9rem; }
.footer-contact i { color: var(--accent); margin-left: 8px; }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Breadcrumb */
.breadcrumb { background: transparent; padding: 0; }
.breadcrumb-item a { color: var(--text-secondary); }
.breadcrumb-item.active { color: var(--text-muted); }

/* Table */
.table { --bs-table-bg: var(--bg-card); color: var(--text-primary); }
.table-dark { --bs-table-bg: #f1f5f9; --bs-table-color: var(--text-primary); }

/* Pagination */
.page-link {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
}

/* Alert */
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* Articles */
.article-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    color: var(--text-primary);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.article-card img { width: 100%; height: 180px; object-fit: cover; }

.article-placeholder {
    height: 180px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--accent);
}

.article-info { padding: 16px; }

.article-category {
    font-size: 0.75rem;
    color: var(--accent-light);
}

.article-info h3 { font-size: 1rem; margin: 8px 0; }

.article-info p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; }

.article-content { line-height: 1.9; }
.article-content p { margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 768px) {
    .hero-slide { height: 250px; }
    .section { padding: 30px 0; }
}

/* Trust Bar */
.trust-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    height: 100%;
}

.trust-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.12), rgba(34, 217, 196, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.trust-item strong {
    display: block;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.trust-item span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Mega Menu */
.mega-dropdown .dropdown-menu {
    border: none;
    padding: 0;
    margin-top: 8px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 520px;
    max-width: 640px;
}

.mega-menu-inner {
    padding: 20px;
}

.mega-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.mega-menu-header strong { font-size: 0.95rem; }

.mega-menu-header a {
    font-size: 0.85rem;
    color: var(--accent-light);
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.mega-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: background 0.2s;
}

.mega-menu-item:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.mega-menu-item img {
    border-radius: 10px;
    flex-shrink: 0;
}

.mega-menu-item span {
    font-size: 0.85rem;
    line-height: 1.4;
}

.mega-menu-footer {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.mega-menu-footer a {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.mega-menu-footer a:hover { color: var(--accent-light); }

/* Product Card Enhancements */
.product-card-top {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.product-brand-tag {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-secondary);
    background: rgba(37, 99, 235, 0.08);
    padding: 2px 8px;
    border-radius: 20px;
}

.product-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.product-sku {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.stock-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.stock-badge.in-stock {
    color: #15803d;
    background: #dcfce7;
}

.stock-badge.out-stock {
    color: #b91c1c;
    background: #fee2e2;
}

.quote-badge,
.bestseller-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 1;
}

.quote-badge {
    background: #0ea5e9;
    color: #fff;
}

.bestseller-badge {
    background: #f59e0b;
    color: #fff;
    top: auto;
    bottom: 10px;
    right: 10px;
    left: auto;
}

.quote-price { color: #0ea5e9 !important; }

/* Sale Section */
.sale-section {
    background: linear-gradient(180deg, #fff5f5 0%, var(--bg-primary) 100%);
    border-top: 1px solid #fecaca;
    border-bottom: 1px solid #fecaca;
}

.sale-section .section-header h2 { color: #b91c1c; }

/* Products Toolbar */
.products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.products-count { flex: 1; }

.sort-form { min-width: 160px; }

.sort-form .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
}

.filter-drawer { max-width: 320px; }

.footer-logo {
    height: 36px;
    width: auto;
}

.b2b-price-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.08), rgba(34, 217, 196, 0.1));
    border: 1px solid rgba(0, 122, 255, 0.15);
}

.b2b-price-box small { color: var(--text-secondary); }
.b2b-price-box strong { color: var(--accent-secondary); }

@media (max-width: 991px) {
    .mega-dropdown .dropdown-menu {
        min-width: 100%;
        max-width: 100%;
    }

    .mega-menu-grid { grid-template-columns: 1fr; }
}
