/* ===========================================================
   EMKAN MEGA MENU — FULLY CONFIGURABLE SYSTEM (V2 → V3 UPGRADED)
   =========================================================== */

/* -----------------------------------------------------------
   GLOBAL CONFIG VARIABLES — COLORS / FONTS / SPACING / SIZES
   ----------------------------------------------------------- */
:root {

    /* ===== COLORS ===== */
    --color-accent: #2a6d58;

    /* Day */
    --color-bg-day: #ffffff;
    --color-text-day: #111111;
    --color-sep-day: rgba(0, 0, 0, .15);

    /* Night */
    --color-bg-night: #1f1f1f;
    --color-text-night: #f4f4f4;
    --color-sep-night: rgba(255, 255, 255, .22);

    /* ===== FONTS ===== */
    --font-main: 'IRANSans', sans-serif;
    --font-size-brand: 15px;
    --font-size-desktop-item: 14px;
    --font-size-desktop-lang: 12px;
    --font-size-mobile-item: 18px;
    --font-size-mobile-lang: 12px;

    /* ===== SPACING ===== */
    --gap-desktop-nav: 22px;
    --padding-topbar-y: 10px;
    --padding-mobile-item-y: 20px;

    /* Height of mobile top bar */
    --mobile-topbar-height: 55px;

    /* ===== BOTTOM BAR ===== */
    --mobile-bottom-height: 56px;
}


/* -----------------------------------------------------------
   THEME SYSTEM
   ----------------------------------------------------------- */
:root[data-theme="light"] {
    --bg: var(--color-bg-day);
    --text: var(--color-text-day);
    --sep: var(--color-sep-day);

    --global-bg: var(--color-bg-day);
    --global-text: var(--color-text-day);
    --global-heading: #000;
    --global-muted: #666;
}

:root[data-theme="dark"] {
    --bg: var(--color-bg-night);
    --text: var(--color-text-night);
    --sep: var(--color-sep-night);

    --global-bg: var(--color-bg-night);
    --global-text: var(--color-text-night);
    --global-heading: #fff;
    --global-muted: #ccc;
}


/* -----------------------------------------------------------
   GLOBAL APPLY
   ----------------------------------------------------------- */
body {
    background: var(--global-bg) !important;
    color: var(--global-text) !important;
    font-family: var(--font-main);
    margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--global-heading) !important;
}

a,
li,
span,
p {
    color: var(--global-text) !important;
}


/* -----------------------------------------------------------
   DESKTOP NAVIGATION
   ----------------------------------------------------------- */
#topbar {
    max-width: 1100px;
    margin: 14px auto 0;
    padding: 0 24px;
}

/* BRAND */
#brand-link {
    display: block;
    text-align: center;
    margin: 4px 0 8px;
    font-weight: 600;
    letter-spacing: .12em;
    font-size: var(--font-size-brand);
    color: var(--global-text);
    text-decoration: none;
}

/* NAV LAYOUT */
.nav-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--sep);
    border-bottom: 1px solid var(--sep);
    padding: var(--padding-topbar-y) 0;
}

/* CENTER ITEMS */
.nav-items {
    display: flex;
    gap: var(--gap-desktop-nav);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-items a {
    all: unset;
    cursor: pointer;
    color: var(--global-text);
    font-size: var(--font-size-desktop-item);
    transition: .25s;
}

.nav-items a:hover {
    color: var(--color-accent) !important;
    opacity: .85;
}

/* LANG */
#lang-switch span {
    cursor: pointer;
    font-size: var(--font-size-desktop-lang);
}

/* THEME */
#theme-toggle {
    all: unset;
    cursor: pointer;
}


/* -----------------------------------------------------------
   ICONS (LIGHT/DARK)
   ----------------------------------------------------------- */
#icon-sun,
#mb-sun,
#icon-moon,
#mb-moon {
    display: none;
}

:root[data-theme="light"] #icon-moon,
:root[data-theme="light"] #mb-moon {
    display: inline;
}

:root[data-theme="dark"] #icon-sun,
:root[data-theme="dark"] #mb-sun {
    display: inline;
}


/* -----------------------------------------------------------
   HIDE MOBILE IN DESKTOP
   ----------------------------------------------------------- */
#mobile-topbar,
#mobile-menu,
#mobile-bottom {
    display: none;
}


/* ===========================================================
   MOBILE VERSION (CLEAN + SLIM MENU)
   =========================================================== */
@media(max-width: 820px) {

    #brand-link,
    .nav-layout {
        display: none !important;
    }

    /* ============ TOP BAR ============ */
    #mobile-topbar {
        display: flex;
        height: var(--mobile-topbar-height);
        background: #4c4c4c;
        color: white;
        font-weight: 600;
        align-items: center;
        justify-content: center;
        letter-spacing: .05em;
        cursor: pointer;
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        font-size: 16px;
        z-index: 100000;
    }

/* ============ MOBILE MENU (SLIM + AUTO HEIGHT) ============ */
#mobile-menu {
    display: block;
    position: absolute !important;
    top: var(--mobile-topbar-height);
    left: 0;
    width: 100%;
    background: #4c4c4c;
    overflow: hidden;
    max-height: 0;
    /* بسته */
    transition: max-height .35s ease-out;
    z-index: 9990;
    transform: translateY(0) !important;
}

/* باز شدن واقعی → به اندازه محتوای واقعی */
#mobile-menu.open {
    max-height: 1000px !important;
    /* سقف منطقی ولی قابل انیمیشن */
}

    #mobile-menu ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    #mobile-menu li {
        text-align: center;
        padding: var(--padding-mobile-item-y) 0;
        border-bottom: 1px solid rgba(255, 255, 255, .25);
    }

    #mobile-menu a {
        color: white;
        font-size: var(--font-size-mobile-item);
        text-decoration: none;
    }


    /* ============ BOTTOM BAR ============ */
    body {
        padding-bottom: var(--mobile-bottom-height);
    }

    #mobile-bottom {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--mobile-bottom-height);
        background: var(--global-bg);
        border-top: 1px solid var(--sep);
        z-index: 999999;
    }

    .bottom-row {
        display: flex;
        margin: auto;
        align-items: center;
        justify-content: center;
        gap: 20px;
    }

    /* زبان */
    #mobile-lang {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    #mobile-lang span {
        cursor: pointer;
        font-size: var(--font-size-mobile-lang);
        opacity: .85;
    }

    #mobile-lang span:hover {
        opacity: 1;
    }

    #mobile-lang span:not(:last-child)::after {
        content: "|";
        margin: 0 6px;
        opacity: .35;
    }

    /* تم */
    #mobile-theme-toggle {
        display: flex;
        align-items: center;
    }

    #mobile-theme-toggle svg {
        width: 18px;
        cursor: pointer;
        opacity: .85;
    }

    #mobile-theme-toggle svg:hover {
        opacity: 1;
    }
}

:root[data-theme="light"] #mobile-menu a {
    color: #ffffff !important;
}