/* =========================
   HEADER BASE
========================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    backdrop-filter: blur(20px);
    background: rgba(20, 25, 40, 0.9);
    transition: transform .24s ease, background 0.3s ease, box-shadow 0.3s ease;
}


/* контейнер */
.header-inner {
    max-width: 1400px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    height: 70px;
    padding: 0 30px;
    transition: height 0.24s ease, padding 0.24s ease;
}

.logo {
    justify-self: start;
}

.main-menu {
    justify-self: center;
}



/* =========================
   LOGO
========================= */

.logo img {
    height: 42px;
    display: block;
    transition: 0.25s ease;
}

.logo:hover img {
    transform: scale(1.08);
    filter: brightness(1.2);
}

.logo:active img {
    transform: scale(0.95);
}

/* =========================
   MENU
========================= */

.main-menu ul {
    display: flex;
    align-items: center;
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-menu a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    position: relative;
}

/* underline hover */
.main-menu a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background: #a78bfa;
    transition: 0.3s;
}

.main-menu a:hover::after {
    width: 100%;
}

/* ===== MEGA MENU NEW ===== */

.mega-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    width: 100%;
    transform: translateY(10px);

    background: linear-gradient(180deg, #2a1f5c, #0f1330);

    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    padding-bottom: 20px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);


    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    pointer-events: none;
    z-index: 9999;
}

.mega-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* контейнер по центру */


/* layout */
.mega-menu-grid {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: clamp(24px, 3.6vw, 48px);
    align-items: start;
    padding-top: 0;
    min-height: calc(100vh - 180px);
}

/* LEFT */
.mega-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 240px;
    flex: 0 0 240px;
    align-self: stretch;
    position: sticky;
    top: 0;
    padding: 10px;
    border-radius: 14px;
    background: rgba(11, 18, 38, 0.55);
    border: 1px solid rgba(167, 139, 250, 0.18);
}

.mega-item {
    color: #b8c0d6;
    border-radius: 10px;
    padding: 10px 12px 10px 18px;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

.mega-item:hover {
    color: #fff;
    background: rgba(167, 139, 250, 0.14);
    transform: translateX(2px);
}

.mega-item.active {
    color: #a78bfa;
    font-weight: 600;
    position: relative;
}

.mega-item.active::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 16px;
    background: #a78bfa;
    border-radius: 4px;
}

/* RIGHT */
.mega-right {
    width: 100%;
    min-height: calc(100vh - 180px);
    min-width: 0;
    align-self: stretch;
}

/* GRID КАРТОЧЕК */
.mega-categories {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-content: start;
    max-height: calc(100vh - 180px);
    overflow-y: scroll;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
    padding-right: 6px;
}

.mega-panel.active .mega-categories {
    max-height: calc(100vh - 180px);
}

.mega-panel.active .mega-categories::-webkit-scrollbar {
    width: 8px;
}

.mega-panel.active .mega-categories::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
}

.mega-panel.active .mega-categories::-webkit-scrollbar-thumb {
    background: rgba(167,139,250,0.7);
    border-radius: 999px;
}

.mega-panel.active .mega-categories::-webkit-scrollbar-thumb:hover {
    background: rgba(167,139,250,0.95);
}

/* КАРТОЧКА */
.mega-card {
    background: linear-gradient(145deg, #111827, #0f172a);
    border-radius: 14px;
    padding: 18px;

    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 96px;

    border: 1px solid rgba(255,255,255,0.05);

    transition: all 0.25s ease;
}

.mega-card span {
    display: block;
    color: #e5e7eb;
    line-height: 1.35;
}

/* glow эффект */
.mega-card:hover {
    background: linear-gradient(145deg, #1f2937, #111827);
    transform: translateY(-2px);

    border-color: rgba(167,139,250,0.5);
    box-shadow: 0 10px 30px rgba(167,139,250,0.2);
}

/* ИКОНКА */
.mega-card img {
    width: 64px;
    height: 64px;
    transition: 0.3s;
    object-fit: contain;
    flex-shrink: 0;

}

.mega-card:hover img {
    transform: scale(1.1);
}

/* PANEL */
.mega-panel {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.mega-right {
    position: relative;
    align-self: stretch;
}

.mega-menu-inner {
    display: flex;
    justify-content: center;
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 18px clamp(16px, 3vw, 36px) 22px;
    min-height: calc(100vh - 180px);
}

.mega-panel.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
    animation: megaPanelFade .18s ease;
}

.mega-card.active {
    border-color: #a78bfa;
    box-shadow: 0 0 0 1px #a78bfa;
}

.mega-card--all {
    border-style: dashed;
    background: linear-gradient(145deg, rgba(167, 139, 250, .14), rgba(79, 70, 229, .10));
}

@keyframes megaPanelFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================
   HEADER ACTIONS
========================= */

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: end;


    min-width: 0; /* КЛЮЧ */
}

.header-actions > a,
.header-actions > button,
.header-actions > .my-search-btn,
.header-actions > .my-account-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;

    background: rgba(255,255,255,0.08);
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.header-actions > a svg,
.header-actions > button svg,
.header-actions > .my-search-btn svg,
.header-actions > .my-account-btn svg {
    width: 18px;
    height: 18px;
}

/* hover */
.header-actions > a:hover,
.header-actions > button:hover,
.header-actions > .my-search-btn:hover,
.header-actions > .my-account-btn:hover {
    background: #6c2bff;
    transform: translateY(-2px);
}

/* active */
.header-actions > a:active,
.header-actions > button:active,
.header-actions > .my-search-btn:active,
.header-actions > .my-account-btn:active {
    transform: scale(0.92);
}

/* =========================
   CART COUNT (бейдж)
========================= */

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;

    background: #ff3b3b;
    color: #fff;
    font-size: 11px;
    font-weight: 600;

    padding: 2px 6px;
    border-radius: 10px;

    min-width: 18px;
    text-align: center;
}

/* =========================
   SCROLL EFFECT
========================= */

.site-header.scrolled {
    background: rgba(10, 15, 30, 0.98);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.site-header.scrolled .header-inner {
    height: 64px;
}

@media (max-width: 767px) {
    .site-header.scrolled .header-inner {
        height: 58px;
    }
}

html {
    scroll-padding-top: 80px;
}


body.admin-bar {
    margin-top: 0;
}

.mega-overlay {
    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, 0.45);

    opacity: 0;
    visibility: hidden;
    transition: 0.25s ease;

    z-index: 9998;
}

.mega-overlay.active {
    opacity: 1;
    visibility: visible;
}






















@media (max-width: 768px) {

    .mega-menu {
        top: 0;
        left: 0;
        width: 100%;
        transform: translateY(10px);
        height: 100vh;
        overflow-y: auto;
        padding: 20px;
    }

    .mega-menu.active {
        transform: translateY(0);
    }

}

@media (min-width: 769px) {
    .mega-menu {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        transform: translateY(10px) !important;
    }

    .mega-menu.active {
        transform: translateY(0) !important;
    }
}

@media (max-width: 768px) {

    .has-mega .mega-menu,
    .mega-overlay {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .mega-categories {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 768px) {

    .mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

}

@media (max-width: 768px) {

    .mega-card {
        padding: 18px;
    }

    .mega-card img {
        width: 50px;
        height: 50px;
    }

}









/* =========================
   SEARCH INLINE (STABLE)
========================= */

.search-inline {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;


    width: 0;
    opacity: 0;

    overflow: visible;

    transition: 0.25s ease;
}

.search-inline.active {
    width: 230px; /* можно 280-320 подгони */
    opacity: 1;
}

/* INPUT */
.search-inline input {
    width: 100%;
    height: 42px;

    padding: 0 14px;

    border-radius: 10px;
    border: none;
    outline: none;

    background: #2f3545;
    color: #fff;
    font-size: 14px;
}

/* RESULTS */
.search-inline .search-results {
    position: absolute;
    top: 54px;
    left: 0;

    width: min(440px, 92vw);
    max-height: 460px;

    background: linear-gradient(180deg, rgba(11,18,32,0.96), rgba(13,18,36,0.98));
    border: 1px solid rgba(167,139,250,0.22);
    border-radius: 18px;

    overflow-y: auto;
    box-shadow:
        0 22px 68px rgba(0,0,0,0.62),
        0 0 0 1px rgba(167,139,250,0.1) inset;

    padding: 10px;

    display: none;
    z-index: 999999;

    font-family: 'DM Sans', sans-serif;
    backdrop-filter: blur(12px);
}

/* SAFE RESET */
.search-inline .search-results * {
    box-sizing: border-box;
}

.search-inline .search-results img {
    display: block;
    max-width: 100%;
}

/* ITEM */
.search-inline .search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: auto;

    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid transparent;

    text-decoration: none;
    color: #fff;

    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

/* IMAGE */
.search-inline .search-item img {
    width: 54px;
    height: 54px;

    object-fit: cover;

    background: #0b1120;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);

    flex-shrink: 0;
}

/* META */
.search-inline .search-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;

    flex: 1;
    min-width: 0;
}

/* TITLE */
.search-inline .title {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* PRICE */
.search-inline .price {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(124,58,237,0.16);
    border: 1px solid rgba(167,139,250,0.45);
    font-size: 12px;
    color: #ddd6fe;
    font-weight: 600;
}

/* HOVER */
.search-inline .search-item:hover {
    background: rgba(124,58,237,0.14);
    border-color: rgba(167,139,250,0.35);
    transform: translateY(-1px);
}

/* BUTTON */
.search-inline .search-all {
    display: block;
    padding: 10px 12px;
    margin-top: 10px;
    border-radius: 12px;
    border: 1px solid rgba(167,139,250,0.42);
    background: linear-gradient(135deg, rgba(124,58,237,0.16), rgba(109,40,217,0.2));

    text-align: center;
    color: #ddd6fe;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.search-inline .search-all:hover {
    background: linear-gradient(135deg, rgba(124,58,237,0.26), rgba(109,40,217,0.28));
    border-color: rgba(167,139,250,0.65);
    color: #fff;
}

.search-inline .search-suggest-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 4px 2px 12px;
    border-bottom: 1px solid rgba(167,139,250,0.18);
}

.search-inline .search-suggest-label {
    font-size: 11px;
    color: #a6a0bb;
    margin-right: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.search-inline .search-suggest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(167,139,250,0.55);
    background: rgba(124,58,237,0.14);
    color: #ddd6fe;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-inline .search-suggest:hover {
    background: rgba(124,58,237,0.28);
    border-color: rgba(167,139,250,0.85);
    color: #fff;
}

.search-inline .no-results {
    display: block;
    text-align: center;
    padding: 24px 10px;
    border-radius: 12px;
    border: 1px dashed rgba(167,139,250,0.26);
    color: #c4b5fd;
    font-size: 13px;
}

/* SCROLL */
.search-inline .search-results::-webkit-scrollbar {
    width: 6px;
}

.search-inline .search-results::-webkit-scrollbar-thumb {
    background: #6c2bff;
    border-radius: 10px;
}



.my-search-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;

    background: rgba(255,255,255,0.08);
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
}

.my-search-btn svg {
    width: 18px;
    height: 18px;
}