﻿/* ==========================================================================
   RoostaBazar - Theme System (Dark / Light Mode) & Card Action Buttons
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. متغیرهای تم و انتقال نرم
   -------------------------------------------------------------------------- */
:root {
    --rb-theme-transition: background-color 0.3s ease, border-color 0.3s ease, color 0.25s ease, box-shadow 0.3s ease;
    
    /* تم روشن (پیش‌فرض) */
    --rb-bg-body: #fcfbf9;
    --rb-bg-card: #ffffff;
    --rb-bg-card-subtle: #f8fafc;
    --rb-bg-header: #ffffff;
    --rb-bg-footer: #f8fafc;
    --rb-bg-modal: #ffffff;
    --rb-bg-input: #ffffff;
    --rb-border: #e2e8f0;
    --rb-border-subtle: #edf2f7;
    --rb-text-main: #0f172a;
    --rb-text-body: #475569;
    --rb-text-muted: #64748b;
    --rb-text-link: #1e5136;
    --rb-primary: #1e5136;
    --rb-primary-hover: #153a26;
    --rb-primary-soft: #ebf4ee;
    --rb-accent-terracotta: #c25934;
    --rb-accent-gold: #d4973b;
    --rb-card-shadow: 0 4px 18px rgba(30, 81, 54, 0.06);
    --rb-card-shadow-hover: 0 12px 28px rgba(30, 81, 54, 0.12);
}

/* تم تاریک (Dark Mode) */
html.dark-theme,
[data-bs-theme="dark"] {
    --rb-bg-body: #0b111a;
    --rb-bg-card: #141c28;
    --rb-bg-card-subtle: #1a2536;
    --rb-bg-header: #141c28;
    --rb-bg-footer: #080d14;
    --rb-bg-modal: #141c28;
    --rb-bg-input: #1a2536;
    --rb-border: #273548;
    --rb-border-subtle: #1e293b;
    --rb-text-main: #f8fafc;
    --rb-text-body: #cbd5e1;
    --rb-text-muted: #94a3b8;
    --rb-text-link: #4ade80;
    --rb-primary: #22c55e;
    --rb-primary-hover: #16a34a;
    --rb-primary-soft: rgba(34, 197, 94, 0.14);
    --rb-accent-terracotta: #fb923c;
    --rb-accent-gold: #fbbf24;
    --rb-card-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
    --rb-card-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.65);
}

/* انتقال نرم هنگام تغییر حالت تم */
body,
header.header-area,
.header-middle,
.header-bottom,
.product-cart-wrap,
.vendor-profile-card,
.rustic-features-bar,
.mobile-header-wrapper-style,
.bottom-nav,
footer.main,
.modal-content,
.adv-search-wrapper {
    transition: var(--rb-theme-transition);
}

/* --------------------------------------------------------------------------
   2. استایل عمومی بدنه و المان‌های پایه در حالت تاریک
   -------------------------------------------------------------------------- */
html.dark-theme,
html.dark-theme body {
    background-color: var(--rb-bg-body) !important;
    color: var(--rb-text-body) !important;
}

html.dark-theme h1,
html.dark-theme h2,
html.dark-theme h3,
html.dark-theme h4,
html.dark-theme h5,
html.dark-theme h6 {
    color: var(--rb-text-main) !important;
}

html.dark-theme p {
    color: var(--rb-text-body) !important;
}

html.dark-theme a {
    color: inherit;
}

html.dark-theme hr {
    border-color: var(--rb-border) !important;
    opacity: 0.25;
}

/* --------------------------------------------------------------------------
   3. هدر، منوها و نوار ناوبری در حالت تاریک
   -------------------------------------------------------------------------- */
html.dark-theme header.header-area,
html.dark-theme .header-middle,
html.dark-theme .header-bottom,
html.dark-theme .header-style-1 {
    background-color: var(--rb-bg-header) !important;
    border-color: var(--rb-border) !important;
}

html.dark-theme .header-bottom.sticky-bar.stick {
    background: rgba(20, 28, 40, 0.95) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

html.dark-theme .main-menu nav > ul > li > a {
    color: #e2e8f0 !important;
}

html.dark-theme .main-menu nav > ul > li > a:hover {
    color: var(--rb-primary) !important;
}

html.dark-theme .header-action-icon-2 > a > span.lable,
html.dark-theme .header-action-icon-2 > span.lable {
    color: var(--rb-text-body) !important;
}

html.dark-theme .header-action-icon-2 > a:hover > span.lable {
    color: var(--rb-primary) !important;
}

html.dark-theme .header-action-icon-2 svg,
html.dark-theme .header-action-icon-2 i {
    color: var(--rb-text-body) !important;
    stroke: var(--rb-text-body) !important;
}

html.dark-theme .header-action-icon-2 > a:hover svg,
html.dark-theme .header-action-icon-2 > a:hover i {
    color: var(--rb-primary) !important;
    stroke: var(--rb-primary) !important;
}

/* باکس جستجو در هدر */
html.dark-theme .adv-search-wrapper {
    background-color: var(--rb-bg-card-subtle) !important;
    border-color: var(--rb-primary) !important;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.15) !important;
}

html.dark-theme .adv-search-control {
    background: transparent !important;
    color: var(--rb-text-main) !important;
}

html.dark-theme .adv-search-control::placeholder {
    color: var(--rb-text-muted) !important;
}

html.dark-theme .search-submit-btn i {
    color: var(--rb-primary) !important;
}

/* منوی بازشوی دسته‌بندی‌ها (Nest Mega Menu) */
html.dark-theme #nestBtn,
html.dark-theme .categories-button-active {
    background: var(--rb-bg-card-subtle) !important;
    color: var(--rb-text-main) !important;
    border-color: var(--rb-border) !important;
}

html.dark-theme .nest-mega-menu {
    background: var(--rb-bg-card) !important;
    border-color: var(--rb-border) !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55) !important;
}

html.dark-theme .nest-sidebar {
    background: #0f1622 !important;
    border-left-color: var(--rb-border) !important;
}

html.dark-theme .nest-nav-item {
    color: var(--rb-text-body) !important;
    border-bottom-color: var(--rb-border-subtle) !important;
}

html.dark-theme .nest-nav-item:hover,
html.dark-theme .nest-nav-item.active {
    background: var(--rb-bg-card-subtle) !important;
    color: var(--rb-primary) !important;
}

html.dark-theme .nest-content {
    background: var(--rb-bg-card) !important;
}

html.dark-theme .nest-col a {
    color: var(--rb-text-body) !important;
}

html.dark-theme .nest-col a:hover {
    color: var(--rb-primary) !important;
}

html.dark-theme .nest-view-all {
    background: var(--rb-primary-soft) !important;
    color: var(--rb-primary) !important;
    border-color: var(--rb-primary) !important;
}

/* منوهای بازشوی حساب کاربری (Cart & Account Dropdown) */
html.dark-theme .cart-dropdown-wrap {
    background: var(--rb-bg-card) !important;
    border-color: var(--rb-border) !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5) !important;
}

html.dark-theme .cart-dropdown-wrap ul li a {
    color: var(--rb-text-body) !important;
}

html.dark-theme .cart-dropdown-wrap ul li a:hover {
    background: var(--rb-bg-card-subtle) !important;
    color: var(--rb-primary) !important;
}

/* --------------------------------------------------------------------------
   4. دکمه سوئیچ تم دارک/لایت (Theme Toggle Button)
   -------------------------------------------------------------------------- */
.theme-toggle-action {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    user-select: none !important;
    padding: 0 4px !important;
}

.theme-toggle-btn {
    position: relative;
    width: 48px;
    height: 26px;
    border-radius: 30px;
    background: #e2e8f0;
    border: 1.5px solid #cbd5e1;
    cursor: pointer;
    outline: none;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.theme-toggle-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.theme-toggle-thumb i {
    font-size: 11px;
    transition: opacity 0.2s ease, transform 0.3s ease;
}

.theme-toggle-thumb .fa-sun {
    color: #f59e0b;
    display: none;
}

.theme-toggle-thumb .fa-moon {
    color: #475569;
    display: inline-block;
}

.theme-toggle-label {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--rb-text-body) !important;
    cursor: pointer;
    white-space: nowrap;
}

/* حالت تاریک دکمه سوئیچ */
html.dark-theme .theme-toggle-btn {
    background: #1e293b;
    border-color: #3b82f6;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 8px rgba(59, 130, 246, 0.3);
}

html.dark-theme .theme-toggle-thumb {
    background: #0f172a;
    transform: translateX(-22px);
}

html.dark-theme .theme-toggle-thumb .fa-sun {
    display: inline-block;
    color: #fbbf24;
}

html.dark-theme .theme-toggle-thumb .fa-moon {
    display: none;
}

html.dark-theme .theme-toggle-label {
    color: #f8fafc !important;
}

/* دکمه تم برای نسخه موبایل در هدر */
.theme-toggle-mobile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--rb-bg-card-subtle);
    border: 1px solid var(--rb-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--rb-text-body);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
    margin: 0 4px;
}

.theme-toggle-mobile-btn:hover {
    color: var(--rb-primary);
    transform: scale(1.08);
}

html.dark-theme .theme-toggle-mobile-btn {
    background: #1a2536;
    border-color: #273548;
    color: #fbbf24;
}

/* ردیف تم در منوی کشویی موبایل (Drawer) */
.mobile-theme-row {
    padding: 12px 18px;
    border-top: 1px solid var(--rb-border-subtle);
    margin-top: 8px;
}

.mobile-theme-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-theme-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--rb-text-main);
}

/* --------------------------------------------------------------------------
   5. کارت‌های محصولات، خدمات و دکمه لایک (Like Button)
   -------------------------------------------------------------------------- */
html.dark-theme .product-cart-wrap {
    background-color: var(--rb-bg-card) !important;
    border-color: var(--rb-border) !important;
    box-shadow: var(--rb-card-shadow) !important;
}

html.dark-theme .product-cart-wrap:hover {
    border-color: var(--rb-primary) !important;
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.16) !important;
}

html.dark-theme .product-img-action-wrap {
    background-color: #0f1622 !important;
}

html.dark-theme .product-content-wrap {
    background-color: var(--rb-bg-card) !important;
}

html.dark-theme .product-content-wrap h2 a {
    color: var(--rb-text-main) !important;
}

html.dark-theme .product-content-wrap h2 a:hover {
    color: var(--rb-primary) !important;
}

html.dark-theme .card-meta-item {
    color: var(--rb-text-muted) !important;
}

html.dark-theme .card-meta-item a {
    color: var(--rb-text-body) !important;
}

html.dark-theme .card-meta-item a:hover {
    color: var(--rb-primary) !important;
}

html.dark-theme .product-bottom-bar {
    border-top-color: var(--rb-border-subtle) !important;
}

html.dark-theme .price-label {
    color: var(--rb-text-muted) !important;
}

html.dark-theme .price-val {
    color: var(--rb-primary) !important;
}

html.dark-theme .btn-rustic-card {
    background: #166534 !important;
    color: #ffffff !important;
}

html.dark-theme .btn-rustic-card:hover {
    background: #22c55e !important;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35) !important;
}

/* ==========================================================================
   دکمه لایک استاندارد و مدرن (کاملاً شناور، شفاف و همیشه قابل مشاهده)
   ========================================================================== */
.rustic-card-action-top,
.product-cart-wrap .product-img-action-wrap .product-action-1 {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 25 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: unset !important;
    width: auto !important;
    height: auto !important;
}

.product-cart-wrap:hover .product-img-action-wrap .product-action-1 {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

/* دکمه دایره‌ای لایک */
.like-circle {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    border: 1.5px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    position: relative !important;
    z-index: 26 !important;
}

.like-circle i {
    font-size: 17px !important;
    color: #64748b !important;
    transition: all 0.22s ease !important;
    display: inline-block !important;
    line-height: 1 !important;
}

.like-circle:hover {
    transform: scale(1.14) !important;
    background: #ffffff !important;
    border-color: #fecdd3 !important;
    box-shadow: 0 6px 18px rgba(225, 29, 72, 0.22) !important;
}

.like-circle:hover i {
    color: #e11d48 !important;
}

/* لایک شده (Active) */
.like-circle.active {
    background: #ffe4e6 !important;
    border-color: #fda4af !important;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.32) !important;
}

.like-circle.active i {
    color: #e11d48 !important;
}

/* انیمیشن پاپ لایک */
@@keyframes likePopKeyframes {
    0% { transform: scale(1); }
    30% { transform: scale(1.35) rotate(-10deg); }
    60% { transform: scale(0.9) rotate(6deg); }
    100% { transform: scale(1) rotate(0); }
}

.like-circle.pop {
    animation: likePopKeyframes 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* دکمه لایک در حالت تاریک (Dark Mode) */
html.dark-theme .like-circle {
    background: #1a2536 !important;
    border-color: #334155 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
}

html.dark-theme .like-circle i {
    color: #94a3b8 !important;
}

html.dark-theme .like-circle:hover {
    background: #243247 !important;
    border-color: #fb7185 !important;
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.35) !important;
}

html.dark-theme .like-circle:hover i {
    color: #fb7185 !important;
}

html.dark-theme .like-circle.active {
    background: rgba(225, 29, 72, 0.25) !important;
    border-color: #f43f5e !important;
    box-shadow: 0 4px 16px rgba(225, 29, 72, 0.35) !important;
}

html.dark-theme .like-circle.active i {
    color: #fb7185 !important;
}

/* --------------------------------------------------------------------------
   6. سایر بخش‌های صفحه اصلی و المان‌های رابط کاربری در دارک مود
   -------------------------------------------------------------------------- */
html.dark-theme .rustic-section-header {
    border-bottom-color: var(--rb-border) !important;
}

html.dark-theme .rustic-title {
    color: var(--rb-text-main) !important;
}

html.dark-theme .view-all-rustic {
    background: var(--rb-primary-soft) !important;
    color: var(--rb-primary) !important;
}

html.dark-theme .view-all-rustic:hover {
    background: var(--rb-primary) !important;
    color: #ffffff !important;
}

html.dark-theme .rustic-features-bar {
    background: var(--rb-bg-card) !important;
    border-color: var(--rb-border) !important;
    box-shadow: var(--rb-card-shadow) !important;
}

html.dark-theme .feature-box:hover {
    background: var(--rb-bg-card-subtle) !important;
}

html.dark-theme .feature-box h4 {
    color: var(--rb-text-main) !important;
}

html.dark-theme .feature-box p {
    color: var(--rb-text-muted) !important;
}

html.dark-theme .selected-city-banner {
    background: linear-gradient(135deg, #0e2b1d 0%, #08170f 100%) !important;
    border-color: #1b4e33 !important;
    color: #86efac !important;
}

html.dark-theme .vendor-profile-card {
    background: var(--rb-bg-card) !important;
    border-color: var(--rb-border) !important;
}

html.dark-theme .vendor-profile-card h6 {
    color: var(--rb-text-main) !important;
}

html.dark-theme .vendor-stat-pill {
    background: var(--rb-bg-card-subtle) !important;
    color: var(--rb-text-muted) !important;
}

/* فوتر */
html.dark-theme footer.main {
    background-color: var(--rb-bg-footer) !important;
    border-top: 1px solid var(--rb-border) !important;
    color: var(--rb-text-body) !important;
}

html.dark-theme footer.main h4,
html.dark-theme footer.main h5,
html.dark-theme footer.main h6 {
    color: var(--rb-text-main) !important;
}

html.dark-theme footer.main p,
html.dark-theme footer.main span,
html.dark-theme footer.main li {
    color: var(--rb-text-muted) !important;
}

html.dark-theme footer.main a {
    color: var(--rb-text-body) !important;
}

html.dark-theme footer.main a:hover {
    color: var(--rb-primary) !important;
}

html.dark-theme .footer-bottom {
    border-top-color: var(--rb-border) !important;
}

/* نوار پایین موبایل (Bottom Nav) */
html.dark-theme .bottom-nav {
    background-color: var(--rb-bg-header) !important;
    border-top: 1px solid var(--rb-border) !important;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4) !important;
}

html.dark-theme .bottom-nav .nav-item {
    color: var(--rb-text-muted) !important;
}

html.dark-theme .bottom-nav .nav-item svg {
    stroke: var(--rb-text-muted) !important;
}

html.dark-theme .bottom-nav .nav-item.active {
    color: var(--rb-accent-gold) !important;
}

html.dark-theme .bottom-nav .nav-item.active svg {
    stroke: var(--rb-accent-gold) !important;
    fill: var(--rb-accent-gold) !important;
}

html.dark-theme .mobile-account-menu {
    background: var(--rb-bg-card) !important;
    border-color: var(--rb-border) !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5) !important;
}

html.dark-theme .mobile-account-menu a,
html.dark-theme .mobile-account-menu button {
    color: var(--rb-text-body) !important;
    border-bottom-color: var(--rb-border-subtle) !important;
}

html.dark-theme .mobile-account-menu a:hover,
html.dark-theme .mobile-account-menu button:hover {
    background: var(--rb-bg-card-subtle) !important;
    color: var(--rb-primary) !important;
}

/* منوی بازشوی موبایل (Drawer) */
html.dark-theme .mobile-header-wrapper-style {
    background-color: var(--rb-bg-header) !important;
    border-left-color: var(--rb-border) !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6) !important;
}

html.dark-theme .mobile-header-top {
    border-bottom-color: var(--rb-border) !important;
}

html.dark-theme .mobile-menu li a {
    color: var(--rb-text-body) !important;
    border-bottom-color: var(--rb-border-subtle) !important;
}

html.dark-theme .mobile-menu li a:hover {
    color: var(--rb-primary) !important;
}

html.dark-theme .single-mobile-header-info a {
    color: var(--rb-text-body) !important;
}

/* پنجره‌های مودال (Modals) */
html.dark-theme .modal-content {
    background-color: var(--rb-bg-card) !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text-main) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65) !important;
}

html.dark-theme .modal-header,
html.dark-theme .modal-footer {
    border-color: var(--rb-border) !important;
}

html.dark-theme .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* فیلدها و فرم‌ها */
html.dark-theme input[type="text"],
html.dark-theme input[type="email"],
html.dark-theme input[type="password"],
html.dark-theme input[type="search"],
html.dark-theme input[type="number"],
html.dark-theme textarea,
html.dark-theme select,
html.dark-theme .form-control {
    background-color: var(--rb-bg-card-subtle) !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text-main) !important;
}

html.dark-theme input:focus,
html.dark-theme textarea:focus,
html.dark-theme select:focus,
html.dark-theme .form-control:focus {
    border-color: var(--rb-primary) !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2) !important;
}

/* Select2 در حالت تاریک */
html.dark-theme .select2-container--default .select2-selection--single {
    background-color: var(--rb-bg-card-subtle) !important;
    border-color: var(--rb-border) !important;
}

html.dark-theme .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--rb-text-main) !important;
}

html.dark-theme .select2-dropdown {
    background-color: var(--rb-bg-card) !important;
    border-color: var(--rb-border) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

html.dark-theme .select2-results__option {
    color: var(--rb-text-body) !important;
}

html.dark-theme .select2-results__option--highlighted {
    background-color: var(--rb-primary) !important;
    color: #ffffff !important;
}

/* دکمه بازگشت به بالا */
html.dark-theme .to-top {
    background: var(--rb-bg-card-subtle) !important;
    color: var(--rb-primary) !important;
    border: 1px solid var(--rb-border) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
}
