/* ==========================================
   header.css - نسخه نهایی v4
   ========================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(247, 247, 245, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(15, 42, 61, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    direction: rtl !important;
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    height: 80px;
    box-sizing: border-box;
    direction: rtl !important;
}

.site-header .logo { grid-column: 1; display: flex; align-items: center; }
.site-header .logo-badge { display: flex; align-items: center; }

.site-header .logo-badge img {
    height: 54px;
    width: auto;
    max-width: none;
    object-fit: contain;
    display: block;
    mix-blend-mode: multiply;
}

.site-header .main-nav {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-header .main-nav > a,
.site-header .main-nav .drop-btn {
    background: none;
    border: none;
    color: #0F2A3D;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    white-space: nowrap;
    font-family: inherit;
    transition: color 0.2s ease, background 0.2s ease;
}

.site-header .main-nav > a:hover,
.site-header .main-nav .drop-btn:hover {
    color: #C9973E;
    background: rgba(201, 151, 62, 0.08);
}

.site-header .main-nav .drop-btn::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.site-header .main-nav .dropdown:hover .drop-btn::after { transform: rotate(-135deg); }
.site-header .main-nav .dropdown { position: relative; }

.site-header .main-nav .dropdown .sumenu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #ffffff;
    border: 1px solid #E6E4DE;
    border-radius: 12px;
    box-shadow: 0 12px 32px -12px rgba(15, 42, 61, 0.18);
    min-width: 200px;
    padding: 14px 8px 8px;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.3s;
}

.site-header .main-nav .dropdown .sumenu::before {
    content: '';
    position: absolute;
    top: -14px;
    right: 0;
    left: 0;
    height: 14px;
}

.site-header .main-nav .dropdown:hover .sumenu,
.site-header .main-nav .dropdown .sumenu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

.site-header .main-nav .sumenu a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #0F2A3D;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.site-header .main-nav .sumenu a:hover { background: #F7F7F5; color: #C9973E; }

/* ---------- ظرف دکمه‌های سمت چپ هدر ---------- */
.site-header .header-cta {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-header .header-cta .btn-accent {
    padding: 10px 22px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    background: #C9973E;
    color: #fff;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.2s ease;
}

.site-header .header-cta .btn-accent:hover { background: #B3822E; transform: translateY(-1px); }

.site-header .header-cta .btn-ghost {
    padding: 9px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    color: #0F2A3D;
    border: 1px solid rgba(15, 42, 61, 0.25);
    background: transparent;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.site-header .header-cta .btn-ghost:hover { border-color: #C9973E; color: #C9973E; }

.site-header .menu { display: none !important; cursor: pointer; grid-column: 3; justify-self: end; }
.site-header .menu-bar { display: none; }

/* ---------- منوی تو در تو دسکتاپ ---------- */
.sumenu-services { min-width: 180px; padding: 14px 6px 6px; }
.nested-dropdown { position: relative; }

.nested-dropdown .nested-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: #0F2A3D;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.nested-dropdown .nested-btn::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.nested-dropdown:hover .nested-btn::after { transform: rotate(-135deg); }
.nested-dropdown:hover .nested-btn { background: #F7F7F5; color: #C9973E; }

.nested-dropdown .nested-sumenu {
    position: absolute;
    right: 100%;
    top: -6px;
    margin-right: 6px;
    background: #ffffff;
    border: 1px solid #E6E4DE;
    border-radius: 12px;
    box-shadow: 0 12px 32px -12px rgba(15, 42, 61, 0.18);
    min-width: 150px;
    padding: 12px 8px 8px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.3s;
}

.nested-dropdown .nested-sumenu::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: -12px;
    width: 12px;
}

.nested-dropdown:hover .nested-sumenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

.nested-dropdown .nested-sumenu a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #0F2A3D;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.nested-dropdown .nested-sumenu a:hover { background: #F7F7F5; color: #C9973E; }

/* ---------- موبایل و تبلت ---------- */
@media (max-width: 992px) {
    .header-inner { height: 70px; padding: 0 15px; grid-template-columns: auto auto; }
    .site-header .logo-badge img { height: 44px; }
    .site-header .main-nav { display: none !important; }
    .site-header .header-cta { display: none !important; }

    .site-header .menu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        z-index: 1001;
        grid-column: 2;
        justify-self: end;
    }

    .site-header .menu-bar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: #0F2A3D;
        z-index: 1000;
        flex-direction: column;
        justify-content: flex-start;
        padding: 20px 26px 30px;
        box-sizing: border-box;
        overflow-y: auto;
        direction: rtl;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-20px);
        transition: all 0.4s ease-in-out;
    }

    .site-header .menu-bar.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

    .menu-close {
        position: absolute;
        top: 16px;
        right: 16px;
        z-index: 5;
        background: none;
        border: none;
        cursor: pointer;
        padding: 6px;
        border-radius: 8px;
    }

    .menu-bar-header {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 14px;
        padding: 30px 0 18px;
        border-bottom: 1px solid rgba(201, 151, 62, 0.8);
        margin-bottom: 6px;
    }

    .menu-bar-logo { display: flex; flex-direction: row; align-items: center; gap: 14px; }

    .menu-bar-logo img {
        width: 62px;
        height: 62px;
        object-fit: contain;
        background: #ffffff;
        border-radius: 50%;
        padding: 8px;
        box-sizing: border-box;
        box-shadow: 0 0 0 2px rgba(201, 151, 62, 0.5);
    }

    .menu-bar-logo-text { text-align: right; }
    .logo-title { display: block; font-size: 1.35rem; font-weight: 800; color: #fff; }
    .logo-title strong { color: #C9973E; }
    .logo-subtitle { display: block; font-size: 0.78rem; color: #C9973E; }

    .menu-bar .main-nav-doc {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        width: 100%;
        margin-top: 12px;
    }

    .menu-bar .dropdown-mobail,
    .menu-bar .main-nav-doc > a {
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        width: 100%;
    }

    .menu-bar .drop-btn-mobail,
    .menu-bar .main-nav-doc > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 18px 4px;
        color: #ffffff;
        font-size: 1.05rem;
        font-weight: 500;
        text-decoration: none;
        background: transparent;
        border: none;
        width: 100%;
        text-align: right;
        font-family: inherit;
        cursor: pointer;
    }

    .menu-bar .drop-btn-mobail::after {
        content: '‹';
        font-size: 1.4rem;
        color: #ffffff;
        transition: transform 0.3s ease;
    }

    .menu-bar .dropdown-mobail.active .drop-btn-mobail::after { transform: rotate(-90deg); }

    .menu-bar .sumenu-mobail {
        display: none;
        background: rgba(255, 255, 255, 0.05);
        padding: 10px 20px;
        border-radius: 0;
        margin-bottom: 0;
        border-right: 3px solid #C9973E;
    }

    .menu-bar .sumenu-mobail.active { display: block; }

    .menu-bar .sumenu-mobail a {
        display: block;
        padding: 11px 0;
        color: #cbd5e1;
        font-size: 0.95rem;
        text-decoration: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        transition: color 0.2s;
    }

    .menu-bar .sumenu-mobail a:last-child { border-bottom: none; }
    .menu-bar .sumenu-mobail a:hover { color: #C9973E; }

    .nested-dropdown-mobail { margin: 0; padding: 0; }

    .nested-btn-mobail {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        color: #cbd5e1;
        font-size: 0.95rem;
        font-weight: 600;
        text-decoration: none;
        background: transparent;
        border: none;
        border-radius: 0;
        cursor: pointer;
        font-family: inherit;
        width: 100%;
        text-align: right;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .nested-btn-mobail::after {
        content: '‹';
        font-size: 1.2rem;
        color: #C9973E;
        transform: rotate(-90deg);
        transition: transform 0.3s ease;
    }

    .nested-dropdown-mobail.active .nested-btn-mobail::after { transform: rotate(90deg); }

    .nested-sumenu-mobail {
        display: none;
        background: rgba(0, 0, 0, 0.15);
        padding: 6px 20px 6px 10px;
        border-radius: 0;
        margin-top: 0;
        border-right: 2px solid rgba(201, 151, 62, 0.5);
    }

    .nested-sumenu-mobail.active { display: block; }

    .nested-sumenu-mobail a {
        display: block;
        padding: 10px 12px;
        color: #94a3b8;
        font-size: 0.9rem;
        text-decoration: none;
        border-radius: 6px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .nested-sumenu-mobail a:last-child { border-bottom: none; }
    .nested-sumenu-mobail a:hover { background: rgba(255, 255, 255, 0.05); color: #C9973E; }

    .mobile-menu-cta { margin-top: 18px; width: 100%; }

    .mobile-menu-footer {
        margin-top: 22px;
        padding-top: 18px;
        border-top: 1px solid rgba(201, 151, 62, 0.8);
        text-align: center;
        color: #94a3b8;
        font-size: 0.85rem;
        line-height: 1.8;
    }

    .mobile-menu-footer p { margin: 5px 0; color: #cbd5e1; }
}