/**
 * Header — 3-row layout matching original design
 *
 * Row 1: Purple top bar (contacts, promo, social)
 * Row 2: White nav bar (logo, page links, search, icons)
 * Row 3: Category mega-menu bar
 *
 * @package RoiArt
 */

/* ══════════════════════════════════════
   ROW 1 — Purple Top Bar
   ══════════════════════════════════════ */

.top-bar {
    background: var(--gradient-cart);
    color: #fff;
    font-size: 13px;
    line-height: 1;
}

.top-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    gap: var(--space-md);
}

/* Left: phone + КОНТАКТИ */
.top-bar__left {
    flex-shrink: 0;
}

.top-bar__contact-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.top-bar__contact-link:hover {
    opacity: 0.85;
    color: #fff;
}

/* Center: countdown + promo */
.top-bar__center {
    flex: 1;
    text-align: center;
}

.top-bar__promo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 13px;
}

.top-bar__countdown {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid rgba(255, 100, 100, 0.5);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-weight: 500;
    font-size: 12px;
}

.top-bar__promo-text {
    font-weight: 500;
}

/* Right: social icons */
.top-bar__right .social-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.top-bar__right .social-links__item {
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-round);
    transition: opacity var(--transition-fast);
}

.top-bar__right .social-links__item:hover {
    opacity: 0.8;
}

/* ══════════════════════════════════════
   ROW 2 — Main Nav Bar (white)
   ══════════════════════════════════════ */

.nav-bar {
    background: #fff;
}

.nav-bar__inner {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    height: 72px;
}

/* Logo */
.nav-bar__logo {
    flex-shrink: 0;
}

.nav-bar__logo .site-logo {
    display: flex;
    align-items: center;
}

.nav-bar__logo .site-logo__img {
    height: 50px;
    width: auto;
}

/* Page links (center) */
.nav-bar__pages {
    flex: 1;
    display: flex;
    justify-content: center;
}

.pages-menu {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.pages-menu li a {
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color var(--transition-fast);
}

.pages-menu li a:hover {
    color: var(--color-primary);
}

/* Right: search + icons */
.nav-bar__right {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    justify-content: flex-end;
}

/* Search — FiboSearch wrapper */
.nav-bar__search {
    flex: 1;
    max-width: 420px;
}

/* Style FiboSearch to match our header */
.nav-bar__search .dgwt-wcas-search-wrapp {
    max-width: 100%;
}

.nav-bar__search .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input {
    height: 40px;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 16px;
    padding: 0 14px;
    background: #fff;
}

.nav-bar__search .dgwt-wcas-search-wrapp .dgwt-wcas-sf-wrapp input[type="search"].dgwt-wcas-search-input:focus {
    border-color: var(--color-primary);
    box-shadow: none;
    outline: none;
}

.nav-bar__search .dgwt-wcas-sf-wrapp button.dgwt-wcas-search-submit {
    background: 0 0;
    border-radius: 100%;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    position: absolute;
    min-height: 33px;
    min-width: 33px;
    height: 33px;
    width: 33px;
    top: 13px;
    right: 15px;
    left: unset !important;
    pointer-events: none;
    transition: none;
}

/* Icons */
.nav-bar__icons {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nav-bar__icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    transition: color var(--transition-fast);
}

.nav-bar__icon:hover {
    color: var(--color-primary);
}

.nav-bar__cart-count,
.nav-bar__wishlist-count {
    position: absolute;
    top: -6px;
    right: -8px;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-bar__cart-count {
    background: #ff6b35;
}

.nav-bar__wishlist-count {
    background: var(--color-primary);
}

/* ══════════════════════════════════════
   ROW 3 — Category Bar (light bg)
   ══════════════════════════════════════ */

.category-bar {
    background: #fff;
    border-top: 1px solid #f0f0f0;
    position: relative;
}

.category-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    height: 46px;
}

.category-menu > li {
    position: relative;
}

.category-menu > li > a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 14px;
    height: 46px;
    white-space: nowrap;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: color var(--transition-fast);
    white-space: nowrap;
}

.category-menu > li:hover > a {
    color: var(--color-primary);
}

/* Emoji icons next to menu text */
.category-menu__icon {
    font-size: 15px;
    line-height: 1;
}

/* Dropdown arrow SVG */
.category-menu__arrow {
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform var(--transition-fast);
}

.category-menu > li:hover > a .category-menu__arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* Dropdown panel */
.category-menu__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--color-bg-white);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: var(--space-sm) 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.category-menu > li:hover > .category-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.category-menu__dropdown li a {
    display: block;
    padding: 10px 20px;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-transform: none;
    letter-spacing: 0;
}

.category-menu__dropdown li a:hover {
    color: var(--color-primary);
    background: rgba(154, 71, 233, 0.04);
    padding-left: 24px;
}

/* ══════════════════════════════════════
   MEGA MENU
   ══════════════════════════════════════ */

.category-menu > li.has-mega {
    position: static;
}

.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    background: var(--color-bg-white);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.25s ease;
    z-index: 1000;
}

.category-menu > li.has-mega:hover > .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Left column — subcategory links */
.mega-menu__categories {
    width: 260px;
    flex-shrink: 0;
    border-right: 1px solid #f0f0f0;
    padding: var(--space-md) 0;
    max-height: 480px;
    overflow-y: auto;
}

.mega-menu__categories ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu__categories li a {
    display: block;
    padding: 11px 24px;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.mega-menu__categories li a:hover,
.mega-menu__categories li a.is-active {
    color: var(--color-primary);
    background: rgba(154, 71, 233, 0.04);
    border-left-color: var(--color-primary);
}

/* Right column — product carousel */
.mega-menu__products {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
    padding: var(--space-lg) 0;
}

.mega-menu__products--full {
    width: 100%;
}

.mega-carousel {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 0 var(--space-md);
}

.mega-carousel__track {
    display: flex;
    gap: var(--space-lg);
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: var(--space-sm) 0;
    min-height: 280px;
    align-items: flex-start;
}

.mega-carousel__track::-webkit-scrollbar {
    display: none;
}

/* Carousel arrows */
.mega-carousel__arrow {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-round);
    border: 1px solid #e0e0e0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
    z-index: 2;
}

.mega-carousel__arrow:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.mega-carousel__arrow.is-hidden {
    opacity: 0.3;
    pointer-events: none;
}

.mega-carousel__arrow--left {
    margin-left: var(--space-sm);
}

.mega-carousel__arrow--right {
    margin-right: var(--space-sm);
}

/* ── Authors mega-menu ── */

.mega-menu__authors {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid #f0f0f0;
    padding: var(--space-lg);
    max-height: 480px;
    overflow-y: auto;
}

.mega-menu__authors-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-md);
}

.mega-menu__authors-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mega-menu__authors-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: var(--color-bg-light);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.mega-menu__authors-letter:hover {
    background: var(--color-primary);
    color: #fff;
}

.mega-menu__authors-footer {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.mega-menu__authors-all {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.mega-menu__authors-all:hover {
    color: var(--color-primary-dark);
}

/* Product mini-cards */
.mega-product {
    flex: 0 0 calc((100% - var(--space-lg) * 3) / 4);
    min-width: 180px;
    max-width: 240px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--color-text-primary);
    transition: transform var(--transition-fast);
}

.mega-product:hover {
    transform: translateY(-3px);
}

.mega-product__image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-bg-light);
}

.mega-product__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mega-product__info {
    padding: var(--space-sm) 0 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mega-product__title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mega-product__price {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.mega-product__price del {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: 11px;
}

.mega-product__price ins {
    text-decoration: none;
    color: var(--color-danger);
}

/* Loader animation */
.mega-carousel__loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 280px;
}

.mega-carousel__loader span {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-round);
    background: var(--color-primary);
    opacity: 0.3;
    animation: megaPulse 1s ease-in-out infinite;
}

.mega-carousel__loader span:nth-child(2) { animation-delay: 0.15s; }
.mega-carousel__loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes megaPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* Empty state */
.mega-carousel__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 280px;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* ══════════════════════════════════════
   STICKY HEADER
   ══════════════════════════════════════ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */

@media (max-width: 991px) {
    /* Hide page links, search, category bar on mobile */
    .nav-bar__pages,
    .nav-bar__search,
    .category-bar {
        display: none;
    }

    .top-bar__center {
        display: none;
    }

    .top-bar__inner {
        justify-content: space-between;
        height: 36px;
    }

    .nav-bar__inner {
        height: 60px;
        justify-content: space-between;
    }

    .nav-bar__logo {
        flex: 0 0 auto;
    }

    .nav-bar__logo .site-logo__img {
        height: 40px;
    }

    .nav-bar__right {
        flex: 0 0 auto;
        gap: var(--space-sm);
    }

    .nav-bar__icons {
        gap: 10px;
    }
}

@media (max-width: 478px) {
    .top-bar__right {
        display: none;
    }

    .top-bar__contact-link {
        font-size: 12px;
    }
}

/* Admin bar offset */
@media (min-width: 783px) {
    body.admin-bar .site-header {
        top: 32px;
    }
}

@media (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}
