/* ═══════════════════════════════════════════════════════════
   رادیک وب — بخش برندهای معتبر
   فایل: assets/css/brands.css
   نسخه: 3.0 — نهایی (هماهنگ با تم سایت + Dark Mode + رفع مشکل هاور)
   ═══════════════════════════════════════════════════════════ */

/* ═══ ریست پایه ═══ */
.rw-brands,
.rw-brands * {
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════
   بخش اصلی — هماهنگ با method و products_featured
   ═══════════════════════════════════════════════════════════ */
.rw-brands {
    padding: 55px 0;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    position: relative;
    overflow: hidden;
    direction: rtl;
    transition: background 0.3s ease;
}

/* ═══ لکه‌های نورانی تزئینی — با رنگ‌های تم ═══ */
.rw-brands::before {
    content: "";
    position: absolute;
    top: -100px;
    right: -100px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.06), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.rw-brands::after {
    content: "";
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.05), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.rw-brands-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════════
   سربرگ وسط‌چین — مطابق قانون ۲ پروژه
   ═══════════════════════════════════════════════════════════ */
.rw-brands-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
    margin-bottom: 40px;
}

.rw-brands-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    background: linear-gradient(135deg,
        rgba(37, 99, 235, 0.1),
        rgba(30, 58, 138, 0.06));
    color: var(--rw-primary, #2563EB) !important;
    border-radius: 50px;
    font-family: 'Shabnam-Bold-P', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.rw-brands-badge i {
    font-size: 13px;
    line-height: 1;
    color: var(--rw-primary, #2563EB) !important;
}

.rw-brands-title {
    font-family: 'Lalezar-ExtraBold', sans-serif;
    font-size: clamp(1.5rem, 2.5vw + 0.5rem, 2.4rem);
    color: var(--rw-heading, #1E3A8A) !important;
    margin: 0;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* خط جداکننده زیر عنوان — مطابق قانون ۲ */
.rw-brands-title::after {
    content: "";
    display: block;
    width: 70px;
    height: 3px;
    background: linear-gradient(90deg,
        transparent,
        var(--rw-primary, #2563EB),
        transparent);
    margin: 12px auto 0;
    border-radius: 3px;
}

.rw-brands-desc {
    font-family: 'Shabnam-Bold-P', Tahoma, sans-serif;
    font-size: 14px;
    color: var(--rw-muted, #64748B) !important;
    margin: 4px 0 0;
    line-height: 1.8;
    max-width: 640px;
}

/* ═══════════════════════════════════════════════════════════
   اسکرول افقی
   ═══════════════════════════════════════════════════════════ */
.rw-brands-scroll-wrap {
    position: relative;
    margin: 0 -20px;
    padding: 0 20px;
}

.rw-brands-scroll {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 14px 4px 24px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    scrollbar-width: thin;
    scrollbar-color: rgba(37, 99, 235, 0.4) transparent;
}

.rw-brands-scroll.rw-brand-grabbing {
    cursor: grabbing;
    scroll-behavior: auto;
    user-select: none;
}

/* ═══ اسکرول‌بار — همرنگ با تم ═══ */
.rw-brands-scroll::-webkit-scrollbar {
    height: 8px;
}
.rw-brands-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    margin: 0 20px;
}
.rw-brands-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg,
        var(--rw-primary, #2563EB),
        var(--rw-secondary, #1E3A8A));
    border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════
   دکمه‌های ناوبری — مثل products_featured
   ═══════════════════════════════════════════════════════════ */
.rw-brands-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    background: #fff;
    border: 2px solid rgba(37, 99, 235, 0.12);
    border-radius: 50%;
    color: var(--rw-primary, #2563EB) !important;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    padding: 0;
}

.rw-brands-nav i {
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit !important;
}

.rw-brands-prev { right: -10px; }
.rw-brands-next { left: -10px; }

.rw-brands-nav:hover {
    background: linear-gradient(135deg,
        var(--rw-primary, #2563EB),
        var(--rw-secondary, #1E3A8A));
    color: #fff !important;
    border-color: transparent;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 10px 28px rgba(37, 99, 235, 0.4);
}

.rw-brands-nav:hover i {
    color: #fff !important;
}

.rw-brands-nav.rw-brands-nav-disabled {
    opacity: 0.3;
    pointer-events: none;
    transform: translateY(-50%) scale(0.9);
}

/* ═══ گرادیان‌های محو لبه — همرنگ پس‌زمینه روشن ═══ */
.rw-brands-fade {
    position: absolute;
    top: 0;
    bottom: 24px;
    width: 50px;
    pointer-events: none;
    z-index: 2;
}
.rw-brands-fade-right {
    right: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.95), transparent);
}
.rw-brands-fade-left {
    left: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.95), transparent);
}

/* ═══════════════════════════════════════════════════════════
   کارت برند — با افکت رنگ از پایین به بالا
   ═══════════════════════════════════════════════════════════ */
.rw-brand-item {
    flex: 0 0 280px;
    max-width: 280px;
    scroll-snap-align: start;
    display: flex;
    animation: rwBrandIn 0.6s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes rwBrandIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ═══ انیمیشن ورود پله‌ای (staggered) ═══ */
.rw-brand-item:nth-child(1) { animation-delay: 0.05s; }
.rw-brand-item:nth-child(2) { animation-delay: 0.10s; }
.rw-brand-item:nth-child(3) { animation-delay: 0.15s; }
.rw-brand-item:nth-child(4) { animation-delay: 0.20s; }
.rw-brand-item:nth-child(5) { animation-delay: 0.25s; }
.rw-brand-item:nth-child(6) { animation-delay: 0.30s; }
.rw-brand-item:nth-child(7) { animation-delay: 0.35s; }
.rw-brand-item:nth-child(8) { animation-delay: 0.40s; }
.rw-brand-item:nth-child(9) { animation-delay: 0.45s; }
.rw-brand-item:nth-child(10) { animation-delay: 0.50s; }
.rw-brand-item:nth-child(11) { animation-delay: 0.55s; }
.rw-brand-item:nth-child(12) { animation-delay: 0.60s; }

/* ═══ خود کارت ═══ */
.rw-brand-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 340px;
    padding: 30px 24px 24px;
    background: var(--rw-card-bg, #FFFFFF);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.04),
        0 1px 2px rgba(0, 0, 0, 0.02);
}

/* ═══════════════════════════════════════════════════════════
   🎨 لایه رنگی — از پایین به بالا پر می‌شود
   گرادیان دقیقاً از متغیرهای تم سایت
   ═══════════════════════════════════════════════════════════ */
.rw-brand-fill {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(135deg,
        var(--rw-primary, #2563EB) 0%,
        var(--rw-secondary, #1E3A8A) 50%,
        var(--rw-primary-hover, #1D4ED8) 100%);
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
    pointer-events: none;
}

.rw-brand-card:hover .rw-brand-fill {
    transform: translateY(0);
}

/* ═══ محتوا — بالای لایه رنگی ═══ */
.rw-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    flex: 1;
    transition: color 0.4s ease;
}

/* ═══════════════════════════════════════════════════════════
   آیکون
   ═══════════════════════════════════════════════════════════ */
.rw-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    background: linear-gradient(135deg,
        rgba(37, 99, 235, 0.12),
        rgba(30, 58, 138, 0.06));
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-radius: 24px;
    color: var(--rw-primary, #2563EB) !important;
    font-size: 40px;
    flex-shrink: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.rw-brand-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.3), transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.rw-brand-card:hover .rw-brand-icon {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    color: #FFFFFF !important;
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.rw-brand-card:hover .rw-brand-icon::after {
    opacity: 1;
}

.rw-brand-icon i {
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit !important;
    transition: color 0.4s ease;
}

/* ═══════════════════════════════════════════════════════════
   نام برند — با !important برای غلبه بر h3 سراسری
   ═══════════════════════════════════════════════════════════ */
.rw-brand-name {
    font-family: 'Lalezar-ExtraBold', sans-serif;
    font-size: 22px;
    color: var(--rw-heading, #1E3A8A) !important;
    margin: 0;
    line-height: 1.3;
    font-weight: 400;
    letter-spacing: 0.3px;
    transition: all 0.4s ease;
}

/* ═══ هاور: نام برند سفید شود ═══ */
.rw-brand-card:hover .rw-brand-name {
    color: #FFFFFF !important;
    transform: scale(1.04);
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   کشور
   ═══════════════════════════════════════════════════════════ */
.rw-brand-country {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.15);
    color: var(--rw-primary, #2563EB) !important;
    border-radius: 20px;
    font-family: 'Shabnam-Bold-P', Tahoma, sans-serif;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.4s ease;
}

.rw-brand-country i {
    font-size: 11px;
    line-height: 1;
    color: inherit !important;
    transition: color 0.4s ease;
}

.rw-brand-card:hover .rw-brand-country {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #FFFFFF !important;
    backdrop-filter: blur(10px);
}

.rw-brand-card:hover .rw-brand-country i {
    color: #FFFFFF !important;
}

/* ═══════════════════════════════════════════════════════════
   توضیحات
   ═══════════════════════════════════════════════════════════ */
.rw-brand-desc {
    font-family: 'Shabnam-Bold-P', Tahoma, sans-serif;
    font-size: 12.5px;
    color: var(--rw-muted, #64748B) !important;
    line-height: 1.9;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.4s ease;
}

.rw-brand-card:hover .rw-brand-desc {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* ═══════════════════════════════════════════════════════════
   دکمه لینک
   ═══════════════════════════════════════════════════════════ */
.rw-brand-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--rw-primary, #2563EB) !important;
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 10px;
    font-family: 'Shabnam-Bold-P', Tahoma, sans-serif;
    font-size: 11px;
    font-weight: 700;
    margin-top: 6px;
    transition: all 0.4s ease;
}

.rw-brand-action i {
    font-size: 12px;
    line-height: 1;
    color: inherit !important;
    transition: transform 0.35s ease, color 0.4s ease;
}

.rw-brand-card:hover .rw-brand-action {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: #FFFFFF !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.rw-brand-card:hover .rw-brand-action i {
    color: #FFFFFF !important;
    transform: translateX(-3px);
}

/* ═══════════════════════════════════════════════════════════
   هاور کارت — بالاتر و درخشان‌تر با رنگ تم
   ═══════════════════════════════════════════════════════════ */
.rw-brand-card:hover {
    transform: translateY(-10px);
    box-shadow:
        0 25px 55px rgba(37, 99, 235, 0.25),
        0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
}

/* ═══════════════════════════════════════════════════════════
   ریسپانسیو
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .rw-brands-prev { right: 0; }
    .rw-brands-next { left: 0; }
}

@media (max-width: 992px) {
    .rw-brands { padding: 45px 0; }
    .rw-brand-item { flex: 0 0 250px; max-width: 250px; }
    .rw-brand-card { padding: 26px 20px 22px; min-height: 320px; }
    .rw-brand-icon { width: 78px; height: 78px; font-size: 36px; border-radius: 20px; }
    .rw-brand-name { font-size: 20px; }
    .rw-brands-nav { width: 42px; height: 42px; font-size: 18px; }
}

@media (max-width: 768px) {
    .rw-brands { padding: 35px 0; }
    .rw-brands-container { padding: 0 14px; }
    .rw-brands-scroll-wrap { margin: 0 -14px; padding: 0 14px; }
    .rw-brands-header { margin-bottom: 28px; }
    .rw-brands-desc { font-size: 12.5px; }
    .rw-brand-item { flex: 0 0 220px; max-width: 220px; }
    .rw-brand-card { min-height: 300px; padding: 24px 18px 20px; }
    .rw-brand-icon { width: 70px; height: 70px; font-size: 32px; border-radius: 18px; }
    .rw-brand-name { font-size: 18px; }
    .rw-brand-desc { font-size: 11.5px; -webkit-line-clamp: 3; }
    .rw-brands-nav { display: none; }
    .rw-brands-fade { width: 30px; }
}

@media (max-width: 480px) {
    .rw-brands { padding: 28px 0; }
    .rw-brand-item { flex: 0 0 200px; max-width: 200px; }
    .rw-brand-card { min-height: 280px; padding: 20px 16px 18px; }
    .rw-brand-icon { width: 64px; height: 64px; font-size: 28px; border-radius: 16px; }
    .rw-brand-name { font-size: 17px; }
    .rw-brand-country { font-size: 10px; padding: 3px 10px; }
    .rw-brand-desc { font-size: 11px; -webkit-line-clamp: 3; }
    .rw-brand-action { font-size: 10px; padding: 8px 14px; }
}

/* ═══════════════════════════════════════════════════════════
   حالت تاریک — هماهنگ با method و products_featured
   ═══════════════════════════════════════════════════════════ */
[data-theme="dark"] .rw-brands {
    background: linear-gradient(180deg, #0B1220 0%, #0F172A 100%);
}

[data-theme="dark"] .rw-brands::before {
    background: radial-gradient(circle, rgba(96, 165, 250, 0.08), transparent 70%);
}

[data-theme="dark"] .rw-brands::after {
    background: radial-gradient(circle, rgba(167, 139, 250, 0.06), transparent 70%);
}

[data-theme="dark"] .rw-brands-badge {
    background: rgba(96, 165, 250, 0.1);
    color: #60A5FA !important;
    border-color: rgba(96, 165, 250, 0.2);
}

[data-theme="dark"] .rw-brands-badge i {
    color: #60A5FA !important;
}

[data-theme="dark"] .rw-brands-title {
    color: #F1F5F9 !important;
}

[data-theme="dark"] .rw-brands-desc {
    color: #94A3B8 !important;
}

[data-theme="dark"] .rw-brand-card {
    background: #111C2F;
    border-color: #1E293B;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .rw-brand-icon {
    background: linear-gradient(135deg,
        rgba(96, 165, 250, 0.15),
        rgba(59, 130, 246, 0.08));
    border-color: rgba(96, 165, 250, 0.25);
    color: #93C5FD !important;
}

[data-theme="dark"] .rw-brand-name {
    color: #F1F5F9 !important;
}

[data-theme="dark"] .rw-brand-country {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.2);
    color: #93C5FD !important;
}

[data-theme="dark"] .rw-brand-desc {
    color: #94A3B8 !important;
}

[data-theme="dark"] .rw-brand-action {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.2);
    color: #93C5FD !important;
}

[data-theme="dark"] .rw-brands-nav {
    background: #111C2F;
    border-color: #334155;
    color: #60A5FA !important;
}

[data-theme="dark"] .rw-brands-fade-right {
    background: linear-gradient(to left, rgba(11, 18, 32, 0.95), transparent);
}

[data-theme="dark"] .rw-brands-fade-left {
    background: linear-gradient(to right, rgba(11, 18, 32, 0.95), transparent);
}

[data-theme="dark"] .rw-brands-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
}

/* ═══ در حالت تاریک، کارت هاور — لایه رنگی روشن‌تر ═══ */
[data-theme="dark"] .rw-brand-fill {
    background: linear-gradient(135deg,
        #3B82F6 0%,
        #1D4ED8 50%,
        #1E3A8A 100%);
}