﻿/* ==============================
   critical.css - نسخه بهینه شده
   ============================== */

:root {
    --bg: #0f1724;
    --panel: #eaeaea;
    --accent: #0ea5a5;
    --text: #404244;
    --muted: #9aa6b2;
    --radius: 0px;
    
}

/* Reset پایه */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
}

body {
    font-family: YekanBakh, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 18px;
    width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
}

/* فونت */
@font-face {
    font-family: YekanBakh;
    src: url('/fonts/YekanBakh/YekanBakh-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ساختار اصلی */
header,
footer,
main,
.main-Wraper,
.slider-container,
.product-container_adv,
nav.menu {
    width: 100%;
}

.main-Wraper,
main {
    min-height: 100vh;
}

    /* ==============================
   تصاویر
   ============================== */

    /* قانون کلی تصاویر داخل محتوا */
    .main-Wraper img,
    .main-Wraper picture,
    .product-tbl_adv img {
        width: 100%;
        height: auto;
        object-fit: cover;
        display: block;
    }

/* لوگو - نباید تحت تأثیر قانون کلی قرار بگیرد */
.cls-logo img,
.footer-up_logo img,
footer .footer-up_logo img {
    width: 150px !important;
    height: auto !important;
    max-width: 150px;
    object-fit: contain !important;
}

/* ==============================
   منو
   ============================== */

.menu-wrap {
    max-width: 1200px;
    margin: 0 auto;
    direction: rtl;
}

nav.menu {
    background: var(--color-background);
    border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(2, 6, 23, 0.6);
    overflow: visible;
    font-size: 1rem;
}

.menu-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    direction: rtl;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}

.logo {
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    border-radius: 6px;
}

/* همبرگر */
.hamburger {
    display: none;
    background: transparent;
    border: 0;
    color: var(--color-text);
    font-size: 1.6rem;
    padding: 0.6rem;
    border-radius: 6px;
    cursor: pointer;
}

/* لینک‌های اصلی منو */
.menu-inner {
    display: flex;
    padding: 0.6rem;
    gap: 0.25rem;
    direction: rtl;
    z-index: 1000001;
    position: relative;
    justify-content: space-between;
}

ul.menu-level {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.25rem;
}

    ul.menu-level > li > a {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.6rem 0.9rem;
        color: var(--color-text);
        text-decoration: none;
        border-radius: 8px;
    }

        ul.menu-level > li > a:hover {
            background: rgba(255, 255, 255, 0.03);
        }

.caret {
    font-size: 0.8rem;
    opacity: 0.8;
    cursor: pointer;
}

/* زیرمنو */
.submenu {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 0.6rem;
    min-width: 220px;
    display: none;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.6);
    z-index: 1000051;
}

    /* پل نامرئی برای جلوگیری از قطع hover */
    .submenu::before {
        content: "";
        position: absolute;
        top: -10px;
        right: 0;
        left: 0;
        height: 10px;
        background: transparent;
    }

    .submenu ul {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .submenu a {
        display: inline-block;
        padding: 0.45rem 0.6rem;
        color: var(--color-text);
        text-decoration: none;
        border-radius: 6px;
    }

        .submenu a:hover {
            background: rgba(255, 255, 255, 0.02);
        }

.has-sub {
    position: relative;
    white-space: nowrap;
}

    .has-sub[data-mega="true"] {
        position: static !important;
    }

        .has-sub[data-mega="true"] .submenu {
            width: 100% !important;
        }

    .has-sub > a {
        display: inline-block;
        width: calc(100% - 20px);
        vertical-align: middle;
    }

    .has-sub > .caret {
        display: inline-block;
        width: 20px;
        text-align: center;
        vertical-align: middle;
    }

/* سطح سوم و بیشتر */
.submenu .has-sub > .submenu {
    top: 0;
    right: 100%;
    margin-right: 8px;
    left: auto;
    min-width: 220px;
    z-index: 1000060;
}

    .submenu .has-sub > .submenu::before {
        content: "";
        position: absolute;
        top: 0;
        right: -10px;
        width: 10px;
        height: 100%;
        background: transparent;
    }

.submenu .has-sub {
    position: relative;
}

    .submenu .has-sub > a {
        display: inline-block;
        width: calc(100% - 20px);
    }

.open > .submenu {
    display: block;
    animation: fadeIn 0.15s ease both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* مگامنو */
nav.menu.mega .submenu {
    position: absolute;
    top: 100%;
    width: 100vw;
    right: calc(50% - 50vw);
    left: auto;
    padding: 1rem;
    box-sizing: border-box;
    z-index: 10000;
}

    nav.menu.mega .submenu::before {
        content: "";
        position: absolute;
        top: -10px;
        right: 0;
        left: 0;
        height: 10px;
        background: transparent;
    }

.mega-panel {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.mega-col {
    flex: 1 1 220px;
    min-width: 180px;
}

    .mega-col h4 {
        margin-bottom: 0.45rem;
        color: var(--muted);
        font-size: 0.95rem;
    }

.mega-item {
    display: block !important;
    padding: 0.35rem 0;
    color: var(--color-text);
}

/* ==============================
   موبایل
   ============================== */

@media (max-width: 900px) {
    .hamburger {
        display: inline-block;
    }

    .menu-inner {
        display: none;
        flex-direction: column;
        padding: 1rem;
    }

        .menu-inner.active {
            display: block;
        }

    ul.menu-level {
        flex-direction: column;
        width: 100%;
    }

        ul.menu-level > li > a {
            width: 100%;
            justify-content: space-between;
        }

    .submenu {
        position: relative;
        top: 0;
        right: 0;
        left: 0;
        box-shadow: none;
        background: transparent;
        padding-left: 1rem;
        margin-right: 0;
        min-width: 100%;
    }

        .submenu::before {
            display: none;
        }

        .submenu .has-sub > .submenu {
            top: 0;
            right: 0;
            left: 0;
            margin-right: 0;
            min-width: 100%;
        }

            .submenu .has-sub > .submenu::before {
                display: none;
            }
}

/* دسکتاپ - نمایش زیرمنو با hover */
@media (min-width: 901px) {
    .has-sub:hover > .submenu {
        display: block;
        animation: fadeIn 0.15s ease both;
    }
}
