/* ============================================================
   دیجی آنی - استایل مدرن و لوکس
   - سیستم طراحی مدرن با گلس‌مورفیسم
   - انیمیشن‌های روان
   - افکت‌های هاور پیشرفته
   ============================================================ */

/* ===== متغیرهای طراحی ===== */
:root {
    /* رنگ‌های برند */
    --color-primary: #6366f1;
    --color-primary-light: #818cf8;
    --color-primary-dark: #4f46e5;
    --color-primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --color-accent: #f59e0b;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* رنگ‌های نئوترال */
    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-tertiary: #94a3b8;
    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-bg-soft: #f1f5f9;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-white: #ffffff;

    /* سایه‌ها - مدرن و چندلایه */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.1), 0 1px 2px -1px rgba(15, 23, 42, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --shadow-glow-lg: 0 0 40px rgba(99, 102, 241, 0.4);

    /* شعاع‌ها */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* ترانزیشن‌ها */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ابعاد */
    --header-height: 76px;
    --container-max-width: 1320px;

    /* فونت‌ها */
    --font-body: 'Vazir', sans-serif;
}

/* ===== ریست مدرن ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* اسکرول‌بار سفارشی */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-alt);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--radius-full);
    border: 2px solid var(--color-bg-alt);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
}

/* ===== کانتینر ===== */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================
   هدر - گلس‌مورفیسم مدرن
   ============================================================ */
.site-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 1px 0 0 rgba(15, 23, 42, 0.05), 0 4px 20px -8px rgba(15, 23, 42, 0.1);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all var(--transition);
}

.site-header.scrolled {
    box-shadow: 0 4px 30px -8px rgba(15, 23, 42, 0.15);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: 24px;
}

/* برند و لوگو */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.brand:hover {
    transform: translateY(-1px);
}

.brand-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.2));
    transition: filter var(--transition);
}

.brand:hover .brand-logo {
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.35));
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    background: var(--color-primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* منوی اصلی */
.main-nav ul {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: inline-block;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 50%;
    transform: translateX(50%);
    width: 0;
    height: 2px;
    background: var(--color-primary-gradient);
    border-radius: var(--radius-full);
    transition: width var(--transition);
}

.nav-link:hover {
    color: var(--color-primary);
    background: rgba(99, 102, 241, 0.06);
}

.nav-link:hover::before,
.nav-link.active::before {
    width: 60%;
}

.nav-link.active {
    color: var(--color-primary);
    background: rgba(99, 102, 241, 0.08);
}

/* آیکون‌های هدر */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: all var(--transition);
    position: relative;
    background: transparent;
}

.action-btn svg {
    width: 22px;
    height: 22px;
    transition: transform var(--transition);
}

.action-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.action-btn:hover svg {
    transform: scale(1.1);
}

.action-btn:active {
    transform: translateY(0);
}

/* شمارنده سبد خرید */
.cart-count {
    position: absolute;
    top: 4px;
    left: 4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--color-primary-gradient);
    color: var(--color-white);
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    animation: bounce-in 0.5s var(--transition-bounce);
}

@keyframes bounce-in {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* دکمه منوی موبایل */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 22px;
    padding: 0;
    transition: all var(--transition);
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--color-text);
    border-radius: var(--radius-full);
    transition: all var(--transition);
    transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ============================================================
   محتوای اصلی
   ============================================================ */
.site-main {
    flex: 1 0 auto;
    width: 100%;
}

/* انیمیشن ورود صفحه */
.fade-in-up {
    animation: fadeInUp 0.6s var(--transition) both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s var(--transition) both;
}

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

/* اسکرول انیمیشن */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   فوتر
   ============================================================ */
.site-footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--color-white);
    padding: 32px 0;
    margin-top: auto;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

.site-footer p {
    text-align: center;
    font-size: 0.9rem;
    color: #cbd5e1;
    letter-spacing: 0.3px;
}

/* ============================================================
   نوتیفیکیشن‌های سایت (Alerts) - مدرن
   ============================================================ */
.site-messages {
    padding: 16px 0 0;
    background: transparent;
}

.site-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.6;
    border: 1px solid transparent;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.4s var(--transition) both;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-alert__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.site-alert__icon svg {
    width: 20px;
    height: 20px;
}

.site-alert__text {
    flex: 1;
    color: inherit;
}

.site-alert__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition);
}

.site-alert__close svg {
    width: 18px;
    height: 18px;
}

.site-alert__close:hover {
    opacity: 1;
}

.site-alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border-color: rgba(16, 185, 129, 0.2);
    backdrop-filter: blur(10px);
}

.site-alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(10px);
}

.site-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.2);
    backdrop-filter: blur(10px);
}

.site-alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border-color: rgba(59, 130, 246, 0.2);
    backdrop-filter: blur(10px);
}

/* ============================================================
   افکت موس - موجی و شفاف (cursor trail)
   ============================================================ */
.cursor-trail {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.5) 0%, rgba(99, 102, 241, 0) 70%);
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    mix-blend-mode: screen;
}

@media (max-width: 768px) {
    .cursor-trail {
        display: none;
    }
}

/* ============================================================
   ریسپانسیو
   ============================================================ */

{# لینک‌های فقط موبایل (جستجو و پیگیری سفارش) - در دسکتاپ مخفی #}
.mobile-only-link {
    display: none;
}

@media (max-width: 992px) {
    .brand-name {
        display: none;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        right: -100%;
        width: 300px;
        height: calc(100vh - var(--header-height));
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: -10px 0 30px -10px rgba(15, 23, 42, 0.2);
        padding: 20px;
        transition: right var(--transition-slow);
        overflow-y: auto;
        z-index: 9998;
    }

    .main-nav.open {
        right: 0;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .nav-link {
        display: block;
        padding: 14px 18px;
        font-size: 1rem;
    }

    .nav-link::before {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex !important;
        flex-shrink: 0;
        z-index: 10000;
    }

    {# مخفی کردن دکمه‌های کم‌اهمیت در تبلت/موبایل برای جا دادن همبرگر #}
    .header-actions .action-btn[title="پیگیری سفارش"] {
        display: none;
    }

    {# نمایش لینک‌های فقط موبایل در منوی همبرگری #}
    .mobile-only-link {
        display: block !important;
    }

    .mobile-only-link .nav-link {
        display: flex !important;
        align-items: center;
        padding: 14px 18px;
        font-size: 1rem;
        border-top: 1px solid #f1f5f9;
        margin-top: 8px;
    }

    .mobile-only-link:first-of-type .nav-link {
        border-top: 2px solid #e2e8f0;
    }
}

@media (max-width: 768px) {
    {# مخفی کردن دکمه‌های بیشتر در موبایل کوچک #}
    .header-actions .action-btn[title="جستجو"] {
        display: none;
    }

    .header-inner {
        gap: 8px;
    }

    .header-actions {
        gap: 4px;
    }

    .action-btn {
        width: 38px;
        height: 38px;
    }

    .action-btn svg {
        width: 18px;
        height: 18px;
    }

    .brand-logo {
        height: 36px;
    }

    {# همبرگر بزرگ‌تر و همیشه قابل کلیک #}
    .mobile-menu-toggle {
        width: 32px;
        height: 26px;
    }

    .mobile-menu-toggle span {
        height: 3px;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 14px;
    }

    .header-inner {
        gap: 6px;
        justify-content: space-between;
    }

    .brand-logo {
        height: 34px;
    }

    .brand {
        gap: 8px;
    }

    .action-btn {
        width: 36px;
        height: 36px;
    }

    .action-btn svg {
        width: 17px;
        height: 17px;
    }

    .header-actions {
        gap: 2px;
    }

    {# سبد خرید همیشه قابل دسترس باشد #}
    .action-btn.cart-btn {
        width: 38px;
        height: 38px;
    }

    .cart-count {
        font-size: 0.65rem;
        min-width: 16px;
        height: 16px;
        line-height: 16px;
        padding: 0 4px;
    }

    .site-alert {
        padding: 12px 14px;
        font-size: 0.85rem;
    }

    {# همبرگر کمی بزرگ‌تر برای لمس راحت‌تر #}
    .mobile-menu-toggle {
        width: 30px;
        height: 24px;
    }

    .mobile-menu-toggle span {
        height: 2.5px;
        border-radius: 2px;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

{# موبایل بسیار کوچک (گوشی‌های قدیمی) #}
@media (max-width: 360px) {
    {# مخفی کردن دکمه زنگوله هم برای فضای بیشتر #}
    .header-actions .push-bell-btn {
        display: none;
    }

    .action-btn {
        width: 34px;
        height: 34px;
    }

    .brand-logo {
        height: 30px;
    }
}

/* ============================================================
   افکت‌های کمکی (Utilities)
   ============================================================ */
.gradient-text {
    background: var(--color-primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.hover-lift {
    transition: transform var(--transition), box-shadow var(--transition);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* انیمیشن لودینگ */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--color-bg-soft) 25%,
        var(--color-bg-alt) 50%,
        var(--color-bg-soft) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* تست حالت درگاه */
.test-mode-notice {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-top: 16px;
    color: #92400e;
    font-size: 0.85rem;
    line-height: 1.7;
    text-align: right;
    backdrop-filter: blur(10px);
}

.test-mode-notice strong { color: #78350f; }

.test-mode-notice code {
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    border: 1px solid rgba(245, 158, 11, 0.3);
    direction: ltr;
    display: inline-block;
}

/* ===== Accessibility: Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .cursor-trail, .cursor-trail-dot {
        display: none !important;
    }
}

/* ===== Accessibility: Skip to content ===== */
.skip-link {
    position: absolute;
    top: -40px;
    right: 0;
    background: #6366f1;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 0 8px;
    z-index: 10000;
    transition: top 0.2s;
    font-size: 0.9rem;
}
.skip-link:focus {
    top: 0;
}

/* ===== Accessibility: Focus visible ===== */
:focus-visible {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
}

/* ===== Screen reader only ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
