/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Vazirmatn", "Tahoma", sans-serif;
}

body {
    background: linear-gradient(135deg, #1a1a1a, #3e2c1c, #2d1b0e);
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Mobile Sidebar (Hamburger) */
.mobile-hamburger {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2100;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255, 204, 102, 0.35);
  background: rgba(0,0,0,0.35);
  color: #ffcc66;
  display: inline-flex; /* visible on all screens */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.mobile-hamburger:active { transform: scale(0.98); }

.mobile-sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 2099; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.mobile-sidebar-overlay.show { opacity: 1; pointer-events: auto; }

.mobile-sidebar {
  position: fixed; top: 0; right: 0; height: 100vh; width: 78%; max-width: 300px;
  background: linear-gradient(160deg, #24160a 0%, #1a0e05 60%, #140a04 100%);
  border-left: 1px solid rgba(255, 204, 102, 0.18);
  border-radius: 16px 0 0 16px;
  box-shadow: -16px 0 40px rgba(0,0,0,0.45);
  z-index: 2101; transform: translateX(100%); transition: transform .3s ease;
  display: flex; flex-direction: column; overflow: hidden;
}
.mobile-sidebar.show { transform: translateX(0); }

.mobile-sidebar-header { position: sticky; top: 0; padding: 10px 14px; color: #ffcc66; font-weight: 700; border-bottom: 1px solid rgba(255,204,102,.16); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(180deg, rgba(255,204,102,0.06), rgba(0,0,0,0)); backdrop-filter: blur(2px); z-index: 1; font-size: .95rem; }
.mobile-sidebar-close { background: none; border: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.mobile-sidebar-search { padding: 8px 12px; border-bottom: 1px solid rgba(255,204,102,.08); }
.mobile-sidebar-search input { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid rgba(255,204,102,.18); background: #25170b; color: #fff; outline: none; font-size: .95rem; }
.mobile-sidebar-search input::placeholder { color: #c9b08a; opacity: .7; }
.mobile-sidebar-links { padding: 4px 0 8px; overflow-y: auto; }
.mobile-sidebar-section-title { padding: 10px 14px 6px; color: #ffcc66; font-size: .9rem; opacity: .9; }
.mobile-separator { height: 1px; margin: 6px 0; background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,204,102,.18), rgba(255,255,255,0)); }
.mobile-sidebar-links a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; color: #eee; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.04); transition: background .2s, color .2s; border-right: 3px solid transparent; font-size: .95rem; }
.mobile-sidebar-links a .label { display: inline-flex; align-items: center; gap: 10px; }
.mobile-sidebar-links a .badge { background: #ffcc66; color: #1a1a1a; border-radius: 999px; padding: 1px 7px; font-weight: 700; font-size: .75rem; min-width: 24px; text-align: center; }
.mobile-sidebar-links a:hover { background: rgba(255, 204, 102, 0.07); color: #ffcc66; }
.mobile-sidebar-links a.active { background: rgba(255, 204, 102, 0.1); color: #ffcc66; border-right-color: #ffcc66; }

/* Scrollbar aesthetics inside sidebar */
.mobile-sidebar-links::-webkit-scrollbar { width: 8px; }
.mobile-sidebar-links::-webkit-scrollbar-thumb { background: rgba(255,204,102,.2); border-radius: 4px; }
.mobile-sidebar-links::-webkit-scrollbar-track { background: transparent; }

/* Keep size the same on desktop; optional tweaks could go here */

/* Particle Effect - بهینه‌سازی شده */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* حذف ذرات در موبایل */
@media (max-width: 768px) {
  .particles {
    display: none !important;
  }
  
  /* حذف انیمیشن‌های سنگین */
  *, *::before, *::after {
    animation-duration: 0.3s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.3s !important;
  }
  
  /* حذف فیلترهای سنگین */
  * {
    backdrop-filter: none !important;
  }

  /* تنظیم body برای موبایل */
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  /* تنظیم toast خوشامدگویی برای موبایل */
  .welcome-toast {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 300px;
    padding: 12px 20px;
    font-size: 1rem;
    text-align: center;
  }

  /* تنظیم دکمه علاقه‌مندی‌های سراسری برای موبایل */
  .global-favorites-btn {
    position: fixed !important;
    top: auto !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border-radius: 25px !important;
    border: 1px solid rgba(255, 204, 102, 0.3);
    padding: 12px 20px;
    font-size: 1rem;
    animation: none; /* Reset animation */
    width: auto !important;
    display: flex !important;
    z-index: 2001 !important;
  }

  @keyframes slideInBottom {
    from {
      transform: translateX(-50%) translateY(100px);
      opacity: 0;
    }
    to {
      transform: translateX(-50%) translateY(0);
      opacity: 1;
    }
  }
  
  /* Ensure animation works properly */
  .global-favorites-btn.animated {
    animation: slideInBottom 1s ease forwards;
  }
  
  /* Mobile animation for favorites button */
  @media (max-width: 768px) {
    .global-favorites-btn.animated {
      animation: slideInBottom 1s ease forwards;
      opacity: 0;
    }
  }

  .global-favorites-btn:hover, .global-favorites-btn:active {
    transform: translateX(-50%) translateY(-2px) !important;
    background: rgba(255, 204, 102, 0.2) !important;
  }

  /* تنظیم پنل علاقه‌مندی‌ها برای موبایل */
  .favorites-panel {
    width: 95%;
    max-width: 400px;
    max-height: 85vh;
    margin: 10px;
  }

  .favorites-panel-header {
    padding: 15px;
    font-size: 1.3rem;
  }

  .favorites-panel-body {
    padding: 15px;
  }

  .favorite-item {
    gap: 12px;
    padding: 8px;
    margin-bottom: 8px;
  }

  .favorite-item img {
    width: 50px;
    height: 50px;
  }

  .favorite-item-info h5 {
    font-size: 0.9rem;
  }

  .favorite-item-info p {
    font-size: 0.8rem;
  }

  .favorite-item-remove {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  .empty-favorites-panel {
    padding: 30px 20px;
    font-size: 0.9rem;
  }
}

/* تنظیمات اضافی برای صفحه‌های کوچک */
@media (max-width: 480px) {
  .welcome-toast {
    top: 5px;
    width: 95%;
    max-width: 280px;
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .global-favorites-btn {
    bottom: 15px !important;
    padding: 10px 15px;
    font-size: 0.9rem;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    display: flex !important;
    z-index: 2001 !important;
  }

  .global-favorites-btn .count {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 5px !important;
  }

  .favorites-panel {
    width: 98%;
    max-width: 350px;
    max-height: 90vh;
    margin: 5px;
  }

  .favorites-panel-header {
    padding: 12px;
    font-size: 1.2rem;
  }

  .favorites-panel-close {
    top: 10px;
    left: 10px;
    font-size: 1.8rem;
  }

  .favorites-panel-body {
    padding: 12px;
  }

  .favorite-item {
    gap: 10px;
    padding: 6px;
    margin-bottom: 6px;
  }

  .favorite-item img {
    width: 45px;
    height: 45px;
  }

  .favorite-item-info h5 {
    font-size: 0.85rem;
    margin-bottom: 3px;
  }

  .favorite-item-info p {
    font-size: 0.75rem;
  }

  .favorite-item-remove {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }

  .empty-favorites-panel {
    padding: 25px 15px;
    font-size: 0.85rem;
  }
}

/* تنظیمات برای صفحه‌های خیلی کوچک */
@media (max-width: 320px) {
  .welcome-toast {
    width: 98%;
    max-width: 260px;
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .global-favorites-btn {
    bottom: 10px !important;
    padding: 8px 12px;
    font-size: 0.85rem;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    display: flex !important;
    z-index: 2001 !important;
  }

  .global-favorites-btn .count {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 5px !important;
  }

  .favorites-panel {
    width: 99%;
    max-width: 310px;
  }

  .favorites-panel-header {
    padding: 10px;
    font-size: 1.1rem;
  }

  .favorites-panel-body {
    padding: 10px;
  }

  .favorite-item img {
    width: 40px;
    height: 40px;
  }

  .favorite-item-info h5 {
    font-size: 0.8rem;
  }

  .favorite-item-info p {
    font-size: 0.7rem;
  }
}

.particle {
    position: absolute;
    background: rgba(255, 204, 102, 0.1);
    border-radius: 50%;
    animation: float 6s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* Welcome Toast */
.welcome-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffcc66, #f59e0b);
    color: #1a1a1a;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    animation: fadeInDown 0.5s ease forwards, fadeOutUp 0.5s ease 4.5s forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
        pointer-events: none;
    }
}

/* Global Favorites Button */
.global-favorites-btn {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%) translateX(-20px); /* Start off-screen */
    background: linear-gradient(135deg, rgba(255, 204, 102, 0.1), rgba(255, 204, 102, 0));
    color: #ffcc66;
    border: 1px solid rgba(255, 204, 102, 0.3);
    border-left: none;
    padding: 15px 20px; /* Tightened spacing */
    border-radius: 0 50px 50px 0;
    cursor: pointer;
    z-index: 2001;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 204, 102, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 1s ease 1s forwards;
}

  /* Make like/favorite button compact with ذخیره label */
  .action-btn.like { gap: 6px !important; font-size: 0.95rem !important; min-width: 64px; height: 38px; align-items: center; justify-content: center; padding: 6px 10px; }
  .action-btn.like span { display: inline !important; font-size: 0.92rem; }
  .action-btn.like::before { content: ''; }

@keyframes slideIn {
    to {
        transform: translateY(-50%) translateX(0);
    }
}

.global-favorites-btn:hover {
    transform: translateY(-50%) translateX(5px);
    box-shadow: 0 12px 35px rgba(255, 204, 102, 0.3);
    background: linear-gradient(135deg, rgba(255, 204, 102, 0.2), rgba(255, 204, 102, 0.05));
}

.global-favorites-btn .count {
    background: #ffcc66;
    color: #1a1a1a;
    font-size: 0.9rem;
    font-weight: bold;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.global-favorites-btn:hover .count {
    transform: scale(1.1);
}

/* Favorites Panel */
.favorites-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.favorites-panel-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.favorites-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 2px solid #3b82f6;
    border-radius: 16px;
    z-index: 1999;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
}

.favorites-panel-overlay.show .favorites-panel {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.favorites-panel-header {
    padding: 24px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e40af;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 2px solid #e5e7eb;
    position: relative;
}

.favorites-panel-close {
    position: absolute;
    top: 20px;
    left: 20px; /* Adjusted for RTL */
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    color: #6b7280;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.2s;
}

.favorites-panel-close:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    transform: scale(1.1);
}

.favorites-panel-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.favorite-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    border-right: 4px solid #3b82f6; /* Adjusted for RTL */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.favorite-item:hover {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.favorite-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s;
    background: #f3f4f6;
}

.favorite-item img:hover {
    transform: scale(1.05);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.favorite-item-info {
    flex-grow: 1;
}

.favorite-item-info h5 {
    margin: 0 0 8px;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 600;
}

.favorite-item-info p {
    margin: 0;
    font-size: 0.95rem;
    color: #64748b;
}

.favorite-item-remove {
    background: #fee2e2;
    color: #ef4444;
    border: 2px solid #fecaca;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-item-remove:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    transform: scale(1.15);
}

.empty-favorites-panel {
    text-align: center;
    padding: 60px 40px;
    color: #94a3b8;
    font-size: 1.1rem;
}

.empty-favorites-panel::before {
    content: '💙';
    display: block;
    font-size: 4rem;
    margin-bottom: 16px;
}

/* Remove legacy floating back buttons (Products/Home) globally */
.back-buttons { display: none !important; }

/* Language Switcher Styles */
.lang-switch {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(147, 51, 234, 0.08)) !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.lang-switch::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.15), 
        rgba(147, 51, 234, 0.15),
        rgba(236, 72, 153, 0.15)
    );
    transition: width 0.5s ease;
    z-index: 0;
}

.lang-switch:hover::before {
    width: 100%;
}

.lang-switch:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(147, 51, 234, 0.18)) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    transform: translateX(-5px) scale(1.02) !important;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3) !important;
}

.lang-switch .icon {
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
    transition: all 0.4s ease;
    animation: rotateGlobe 3s linear infinite;
}

.lang-switch:hover .icon {
    transform: scale(1.3) rotate(360deg) !important;
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.8));
    animation-play-state: paused;
}

@keyframes rotateGlobe {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.lang-switch::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #9333ea, #ec4899);
    transition: width 0.4s ease;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
}

.lang-switch:hover::after {
    width: 100%;
}

/* Language text styling */
.lang-switch span:not(.icon) {
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.lang-switch:hover span:not(.icon) {
    color: #60a5fa !important;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
    letter-spacing: 0.5px;
}

/* Language selection modal enhancements */
.lang-modal-overlay {
    backdrop-filter: blur(8px) !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lang-modal {
    animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Language selection buttons in modal */
.lang-option-btn {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.lang-option-btn::before {
    content: '✓';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    font-size: 20px;
    color: #10b981;
    transition: transform 0.3s ease;
}

.lang-option-btn:hover::before {
    transform: translateY(-50%) scale(1);
}

.lang-option-btn:hover {
    transform: translateX(-5px) scale(1.03);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

