/* --- 1. تعریف متغیرهای رنگ (Color Palette) --- */
:root {
    --primary-color: #00a550;       
    --primary-dark: #008f45;        
    --text-main: #111827;           
    --bg-body: #f8fafc;    
    --bg-overlay-shape: #f9fafb; 
}

/* --- 2. تنظیمات عمومی --- */
body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Canvas */
#particle-canvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%; z-index: -50; pointer-events: none;
}

/* Utility */
.text-main { color: var(--text-main); }
.text-primary { color: var(--primary-color); }
.bg-primary { background-color: var(--primary-color); }
.bg-main { background-color: #1f2937; }

/* Gradient Text */
.animate-gradient-text {
    background-size: 200% auto;
    animation: textShine 3s linear infinite;
}
@keyframes textShine { to { background-position: 200% center; } }

/* Footer Gradient */
.bg-green-footer-gradient {
    background: linear-gradient(135deg, #022c22 0%, #14532d 50%, #166534 100%);
}

/* --- HEADER GLASS --- */
.nav-link {
    position: relative; /* مطمئن می‌شویم که پوزیشن دارد */
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0; width: 0; height: 2px;
    background: var(--primary-color);
    transition: width 0.3s;
}

/* 
   تغییر مهم: قسمت .nav-link:hover::after را حذف کردیم 
   تا موقع هاور کردن خط زیرش نیاید.
   فقط وقتی کلاس active داشته باشد خط نمایش داده می‌شود.
*/
.nav-link.active::after { width: 100%; }

/* --- SLIDER --- */
.hero-slider-container { transform-style: preserve-3d; }
.hero-slide {
    position: absolute; inset: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center;
    opacity: 0; transition: opacity 0.8s ease;
}
.hero-slide.active { opacity: 1; }

/* --- PRODUCT CARD MODERN --- */
.product-card-modern {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.5);
}
.product-card-modern:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px -5px rgba(0, 165, 80, 0.15);
    border-color: var(--primary-color);
}
.product-image-glow {
    position: absolute; inset: 0;
    background: radial-gradient(circle, rgba(0,165,80,0.2) 0%, rgba(0,0,0,0) 70%);
    opacity: 0; transition: opacity 0.5s;
}
.product-card-modern:hover .product-image-glow { opacity: 1; }

/* --- ANIMATIONS --- */
@keyframes spin-slow { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.animate-spin-slow { animation: spin-slow 20s linear infinite; }

@keyframes float-clean {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.animate-float-clean { animation: float-clean 4s ease-in-out infinite; }

@keyframes pulse-slow {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}
.animate-pulse-slow { animation: pulse-slow 8s infinite; }

@keyframes tada {
    0% { transform: scale(1); }
    10%, 20% { transform: scale(0.9) rotate(-3deg); }
    30%, 50%, 70%, 90% { transform: scale(1.1) rotate(3deg); }
    40%, 60%, 80% { transform: scale(1.1) rotate(-3deg); }
    100% { transform: scale(1) rotate(0); }
}
.animate-tada { animation: tada 1.5s infinite; }

/* --- SCROLL & FAB --- */
#scroll-top-btn.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
#fab-container.active #sub-buttons { 
    opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; 
}
#fab-container.active #fab-icon-closed { opacity: 0; transform: rotate(180deg) scale(0.5); }
#fab-container.active #fab-icon-open { opacity: 1; transform: rotate(0deg) scale(1); }

/* --- MODAL --- */
#product-modal.active { display: flex; }
#product-modal.active #modal-backdrop { opacity: 1; }
#product-modal.active #modal-card { opacity: 1; transform: scale(1); }

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

/* --- REVEAL --- */
.reveal-item { opacity: 0; transition: all 1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.effect-slide-right { transform: translateX(50px); }
.effect-slide-left { transform: translateX(-50px); }
.reveal-item.active { opacity: 1; transform: translate(0); }

/* --- MOBILE MENU OVERLAY --- */
#mobile-menu-overlay {
    transition: transform 0.6s cubic-bezier(0.7, 0, 0.2, 1);
    will-change: transform;
}
#mobile-menu-overlay.active { transform: translateX(0); }

/* Glassmorphism Details */
.mobile-link { position: relative; }
.mobile-link::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 0; height: 100%;
    background: rgba(255,255,255,0.1);
    transition: width 0.3s ease;
    z-index: 0;
}
.mobile-link:hover::before { width: 100%; }

/* Masonry for Gallery */
.masonry-grid { column-count: 1; column-gap: 1.5rem; }
@media (min-width: 640px) { .masonry-grid { column-count: 2; } }
@media (min-width: 1024px) { .masonry-grid { column-count: 3; } }
.masonry-item { break-inside: avoid; margin-bottom: 1.5rem; }

/* --- LENIS --- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* --- انیمیشن‌های اختصاصی بخش مسیر موفقیت --- */
.effect-expand-width {
    width: 0 !important;
    opacity: 0;
    transform-origin: right center;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}
.reveal-item.active.effect-expand-width {
    width: 100% !important;
    opacity: 1;
}

.effect-step {
    opacity: 0;
    transform: translateY(50px) scale(0.8);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.reveal-item.active.effect-step {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.group:hover .group-hover\:rotate-\[360deg\] {
    transform: scale(1.1) rotate(360deg);
}

.delay-500 { transition-delay: 0.5s; }
.delay-700 { transition-delay: 0.7s; }

/* --- FLOATING MOBILE MENU --- */
/* کانتینر اصلی */
#mobile-menu-container.active {
    visibility: visible;
    pointer-events: auto;
}
/* بک‌دراپ (تاریکی پشت) */
#mobile-menu-container.active #menu-backdrop {
    opacity: 1;
    pointer-events: auto; /* فعال شدن کلیک */
}
/* کارت منو (انیمیشن باز شدن فنری) */
#mobile-menu-container.active #menu-card {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* آیتم‌های منو */
.menu-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 20px;
    transition: all 0.2s ease;
    background: transparent;
    overflow: hidden;
}
/* حالت هاور */
.menu-item:hover {
    background: rgba(0, 165, 80, 0.05);
}
/* آیکون‌ها */
.menu-item .icon-box {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: #f3f4f6;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    z-index: 10;
}

/* --- حالت ACTIVE (صفحه فعلی) --- */
.menu-item.active {
    background: #f0fdf4; /* سبز خیلی کمرنگ */
}
.menu-item.active .icon-box {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 165, 80, 0.3);
    transform: scale(1.1);
}

/* نشانگر نوری سبز سمت راست */
.active-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--primary-color);
    border-radius: 4px 0 0 4px;
    transition: height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
}
.menu-item.active .active-indicator {
    height: 60%;
    opacity: 1;
}

/* مخفی کردن اسکرول‌بار در حالت افقی */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@keyframes shimmer {
    0% { background-position: 150% 0; }
    100% { background-position: -50% 0; }
}
.animate-shimmer {
    animation: shimmer 1.5s infinite linear;
}
.masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease, display 0.3s allow-discrete;
    display: block;
}
.gallery-modal-backdrop.active {
    padding-top: 80px; /* یا env(safe-area-inset-top) برای آیفون */
}

@media (min-width: 768px) {
    .gallery-modal-backdrop.active {
        padding-top: 0; /* در دسکتاپ لازم نیست */
    }
}
.gallery-modal-content {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 80px; /* فاصله از بالای صفحه در موبایل */
}

@media (min-width: 768px) {
    .gallery-modal-content {
        margin-top: 0; /* در دسکتاپ صفر باشه */
    }
}
/* افکت glow خفن برای دسکتاپ */
.glow-effect {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.6s ease;
}
.product-card-desktop:hover .glow-effect {
    opacity: 1;
}
.product-card-desktop {
    background: white;
    border-radius: 2rem;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: all 0.5s ease;
}
.product-card-desktop:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* اسکرول خیلی نرم در موبایل */
#mobile-product-slider {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
/* اسکرول خیلی نرم و مخفی اسکرول‌بار */
#mobile-product-slider {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}