/* =========================================================
   TECHNOTO HEADER - header.css
   تمام استایل‌ها با کلاس‌های اختصاصی محدود شده‌اند.
   ========================================================= */

:root {
    --tech-primary: #5267f6;
    --tech-primary-dark: #3546b7;
    --tech-text: #171a2b;
    --tech-muted: #667085;
    --tech-glass-border: rgba(110, 125, 255, .20);
    --tech-header-shadow: 0 15px 45px rgba(43, 48, 92, .12);
}

.modern-header,
.tpoffcanvas-area,
.site-search-popup {
    direction: rtl;
    font-family: inherit;
}

.modern-header *,
.tpoffcanvas-area *,
.site-search-popup * {
    box-sizing: border-box;
}

.modern-header {
    position: fixed;
    inset: 18px 0 auto;
    z-index: 9990;
    width: 100%;
    padding: 0 28px;
    pointer-events: none;
}

.modern-header__inner {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1380px;
    height: 78px;
    margin: 0 auto;
    padding: 0 18px;
    pointer-events: auto;
    background: linear-gradient(135deg, rgba(255,255,255,.76), rgba(239,243,255,.62));
    -webkit-backdrop-filter: blur(24px) saturate(155%);
    backdrop-filter: blur(24px) saturate(155%);
    border: 1px solid var(--tech-glass-border);
    border-radius: 22px;
    box-shadow: var(--tech-header-shadow), inset 0 1px 0 rgba(255,255,255,.9);
    transition: height .3s ease, background .3s ease, box-shadow .3s ease;
}

.modern-header__inner::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(110deg, rgba(255,255,255,.35), transparent 36%, transparent 72%, rgba(100,115,255,.06));
}

.modern-header__logo {
    position: relative;
    z-index: 1;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    text-decoration: none;
}

.modern-header__logo img,
.tpoffcanvas__logo img,
.site-search-popup__logo img {
    display: block;
    width: auto;
    max-width: 145px;
    max-height: 42px;
    object-fit: contain;
}

.modern-header__nav {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1 1 auto;
    justify-content: center;
}

.modern-header__nav ul,
.modern-submenu,
.mobile-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.modern-header__nav > ul {
    display: flex;
    align-items: center;
    gap: 4px;
}

.modern-header__nav li {
    position: relative;
}

.modern-header__nav > ul > li > a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 46px;
    padding: 0 17px;
    color: var(--tech-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 13px;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}

.modern-header__nav > ul > li > a:hover,
.modern-header__nav > ul > li.is-active > a {
    color: var(--tech-primary-dark);
    background: rgba(255,255,255,.42);
}

.modern-header__nav > ul > li.is-active > a::after {
    content: "";
    position: absolute;
    right: 20px;
    bottom: 3px;
    left: 20px;
    height: 2px;
    border-radius: 20px;
    background: linear-gradient(90deg, #4b5cff, #7564e8);
}

.menu-arrow {
    display: inline-block;
    color: var(--tech-muted);
    transition: transform .2s ease;
}

.has-submenu:hover > a .menu-arrow,
.has-submenu:focus-within > a .menu-arrow {
    transform: rotate(180deg);
}

.modern-submenu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 8px;
    background: rgba(255,255,255,.94);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid var(--tech-glass-border);
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(45,50,100,.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(7px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.has-submenu:hover > .modern-submenu,
.has-submenu:focus-within > .modern-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.modern-submenu a {
    display: block;
    padding: 11px 13px;
    color: var(--tech-text);
    font-size: 13px;
    text-decoration: none;
    border-radius: 10px;
    transition: color .2s ease, background .2s ease;
}

.modern-submenu a:hover {
    color: var(--tech-primary-dark);
    background: rgba(82,98,255,.08);
}

.modern-header__actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.modern-search-trigger,
.modern-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 14px;
    color: var(--tech-text);
    font-size: 13px;
    text-decoration: none;
    background: rgba(255,255,255,.35);
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 13px;
    cursor: pointer;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}

.modern-search-trigger {
    width: 46px;
    padding: 0;
    font-size: 16px;
}

.modern-search-trigger:hover,
.modern-login:hover {
    color: var(--tech-primary-dark);
    background: rgba(255,255,255,.72);
    transform: translateY(-1px);
}

.modern-start-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 46px;
    padding: 0 19px;
    overflow: hidden;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: linear-gradient(135deg, #5267f6, #5963dc 55%, #6d58d8);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 13px;
    box-shadow: 0 9px 24px rgba(77,87,218,.23);
    transition: transform .2s ease, box-shadow .2s ease;
}

.modern-start-btn:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(77,87,218,.3);
}

.modern-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(255,255,255,.5);
    border: 1px solid var(--tech-glass-border);
    border-radius: 12px;
    cursor: pointer;
}

.modern-menu-toggle span {
    display: block;
    width: 19px;
    height: 2px;
    background: var(--tech-text);
    border-radius: 3px;
    transition: transform .2s ease, opacity .2s ease;
}

.modern-header.scrolled .modern-header__inner {
    height: 68px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 15px 42px rgba(43,48,92,.15);
}

/* Mobile offcanvas */
.tpoffcanvas-area {
    position: relative;
    z-index: 10000;
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(24,29,57,.34);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}

.tpoffcanvas {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 10001;
    width: min(410px, calc(100% - 24px));
    padding: 30px 24px;
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(255,255,255,.97), rgba(239,242,255,.95));
    border: 1px solid var(--tech-glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(25,30,70,.22);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(110%);
    transition: transform .3s ease, opacity .25s ease, visibility .3s ease;
}

.tpoffcanvas-area.is-open .mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.tpoffcanvas-area.is-open .tpoffcanvas {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

.tpoffcanvas__close-btn {
    position: absolute;
    top: 15px;
    left: 15px;
}

.tpoffcanvas__close-btn .close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--tech-text);
    font-size: 28px;
    line-height: 1;
    background: rgba(255,255,255,.8);
    border: 1px solid var(--tech-glass-border);
    border-radius: 50%;
    cursor: pointer;
}

.tpoffcanvas__logo {
    display: inline-flex;
    padding: 4px 0 22px;
    border-bottom: 1px solid rgba(50,58,110,.1);
}

.tpoffcanvas__logo img {
    max-width: 140px;
    max-height: 40px;
}

.tpoffcanvas .mobile-menu {
    margin-top: 20px;
}

.tpoffcanvas .mobile-menu li {
    margin-bottom: 5px;
}

.tpoffcanvas .mobile-menu li > a,
.mobile-menu__parent > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 49px;
    padding: 0 15px;
    color: var(--tech-text);
    font-size: 14px;
    text-decoration: none;
    border-radius: 12px;
    transition: color .2s ease, background .2s ease;
}

.tpoffcanvas .mobile-menu li > a:hover,
.mobile-menu__parent > a:hover {
    color: var(--tech-primary-dark);
    background: rgba(82,98,255,.08);
}

.mobile-menu__parent {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-menu__parent > a {
    flex: 1;
}

.mobile-submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--tech-muted);
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.mobile-menu-arrow {
    display: inline-block;
    transition: transform .2s ease;
}

.mobile-has-submenu.is-open .mobile-menu-arrow {
    transform: rotate(180deg);
}

.tpoffcanvas .mobile-has-submenu > .submenu {
    display: none;
    padding: 4px 13px 8px 0;
}

.tpoffcanvas .mobile-has-submenu.is-open > .submenu {
    display: block;
}

.tpoffcanvas .mobile-menu .submenu a {
    min-height: 42px;
    color: var(--tech-muted);
    font-size: 13px;
}

.mobile-menu__divider {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(50,58,110,.1);
}

.tpoffcanvas .mobile-menu li > .mobile-menu__cta {
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #5267f6, #6d58d8);
}

/* Search popup */
.site-search-popup {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 20px 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

.site-search-popup.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.site-search-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20,25,50,.58);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.site-search-popup__dialog {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    padding: 25px;
    background: #fff;
    border: 1px solid rgba(110,125,255,.18);
    border-radius: 20px;
    box-shadow: 0 25px 70px rgba(0,0,0,.2);
}

.site-search-popup__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.site-search-popup__logo img {
    max-width: 130px;
    max-height: 38px;
}

.site-search-popup__close {
    width: 38px;
    height: 38px;
    color: var(--tech-text);
    font-size: 27px;
    background: #f3f4f8;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.site-search-form {
    display: flex;
    align-items: center;
    border: 1px solid #e1e4ee;
    border-radius: 13px;
    overflow: hidden;
}

.site-search-form input {
    flex: 1;
    min-width: 0;
    height: 54px;
    padding: 0 16px;
    color: var(--tech-text);
    background: #fff;
    border: 0;
    outline: 0;
    font: inherit;
}

.site-search-form button {
    width: 55px;
    height: 54px;
    color: #fff;
    background: var(--tech-primary);
    border: 0;
    cursor: pointer;
}

/* Preloader and scroll-to-top */
.site-preloader {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: opacity .35s ease, visibility .35s ease;
}

.site-preloader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.site-preloader__spinner {
    display: flex;
    gap: 8px;
}

.site-preloader__spinner span {
    width: 12px;
    height: 12px;
    background: var(--tech-primary);
    border-radius: 50%;
    animation: tech-loader-bounce .7s infinite alternate;
}

.site-preloader__spinner span:nth-child(2) {
    animation-delay: .2s;
}

@keyframes tech-loader-bounce {
    to { transform: translateY(-10px); opacity: .55; }
}

.site-scroll-top {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 9000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    color: #fff;
    background: var(--tech-primary);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(82,103,246,.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    cursor: pointer;
    transition: .2s ease;
}

.site-scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

body.mobile-menu-open,
body.search-popup-open {
    overflow: hidden;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 1199px) {
    .modern-header { padding: 0 18px; }
    .modern-header__nav > ul > li > a { padding: 0 11px; font-size: 13px; }
    .modern-login { padding: 0 11px; }
    .modern-start-btn { padding: 0 14px; }
}

@media (max-width: 991px) {
    .modern-header { top: 12px; padding: 0 14px; }
    .modern-header__inner { height: 68px; padding: 0 12px; }
    .modern-header__nav { display: none; }
    .modern-login, .modern-start-btn { display: none; }
    .modern-menu-toggle { display: flex; }
    .modern-header__logo { margin-left: auto; }
}

@media (max-width: 575px) {
    .modern-header { top: 8px; padding: 0 9px; }
    .modern-header__inner { height: 62px; padding: 0 10px; border-radius: 16px; }
    .modern-header__logo img { max-width: 120px; max-height: 35px; }
    .modern-menu-toggle { width: 42px; height: 42px; }
    .site-search-popup { padding: 8vh 12px 12px; }
    .site-search-popup__dialog { padding: 18px; }
    .site-scroll-top { right: 15px; bottom: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    .modern-header *, .tpoffcanvas-area *, .site-search-popup *,
    .site-preloader *, .site-scroll-top {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
