/* ==========================================================
   HEADER + ANNOUNCEMENT BAR
   ========================================================== */
.announcement-bar {
    background: var(--color-forest);
    color: white;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 100;
    transition: height 0.3s ease, opacity 0.3s ease;
    position: relative;
}
.announcement-bar.hidden { height: 0; opacity: 0; pointer-events: none; }

.announcement-slider {
    position: relative;
    width: 100%;
    height: 100%;
}
.announcement-item {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: white;
    text-decoration: none;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.announcement-item.is-active {
    opacity: 1;
    transform: translateY(0);
}
.announcement-item.is-leaving {
    opacity: 0;
    transform: translateY(-100%);
}
a.announcement-item:hover { color: var(--color-gold-light); }
.announcement-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 247, 242, 0.92);
    backdrop-filter: blur(15px);
    transition: box-shadow 0.3s ease;
}
.header.scrolled { box-shadow: 0 2px 20px rgba(61, 79, 57, 0.08); }

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 3rem;
    transition: padding 0.3s ease;
    min-height: 70px;
}
.header.scrolled .header-main { padding: 0.4rem 3rem; min-height: 50px; }

/* חיפוש */
.header-search { flex: 0 0 260px; max-width: 260px; transition: all 0.3s ease; }
.header.scrolled .header-search { flex: 0 0 0; max-width: 0; opacity: 0; padding: 0; margin: 0; overflow: hidden; }
.search-wrapper { position: relative; }
.search-input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.4rem;
    border: 1px solid rgba(61, 79, 57, 0.12);
    border-radius: 25px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    background: white;
    outline: none;
}
.search-input:focus {
    border-color: var(--color-sage);
    box-shadow: 0 0 0 3px rgba(122, 139, 111, 0.15);
}
.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-sage);
}

/* ==========================================================
   SEARCH DROPDOWN (השלמה אוטומטית)
   ========================================================== */
.search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(61, 79, 57, 0.18);
    overflow: hidden;
    max-height: 520px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    min-width: 340px;
    animation: searchDropdownIn 0.2s ease;
}
.search-dropdown.active { display: block; }
@keyframes searchDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* פריט מוצר */
.search-item {
    display: flex;
    gap: 0.9rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--color-forest);
    transition: background 0.15s;
    border-bottom: 1px solid rgba(61, 79, 57, 0.05);
    align-items: center;
}
.search-item:last-of-type { border-bottom: none; }
.search-item:hover { background: var(--color-cream); }
.search-item-img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--color-cream);
}
.search-item-info { flex: 1; min-width: 0; }
.search-item-cat {
    font-size: 0.6rem;
    color: var(--color-sage);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.1rem;
}
.search-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-forest);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.15rem;
}
.search-item-price {
    font-family: var(--font-price);
    font-size: 0.85rem;
    color: var(--color-sage-dark);
    font-weight: 600;
}
.search-item-price del { opacity: 0.5; font-weight: 400; margin-right: 0.3rem; font-size: 0.75rem; }
.search-item-price ins { background: none; text-decoration: none; color: var(--color-rose-deep); font-weight: 700; }

/* מצבים */
.search-loading, .search-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--color-sage);
    font-size: 0.9rem;
}
.search-loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 0.5rem;
    border: 2px solid var(--color-sage-light);
    border-top-color: var(--color-sage);
    border-radius: 50%;
    animation: searchSpin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes searchSpin { to { transform: rotate(360deg); } }

/* קישור "הצג את כל התוצאות" */
.search-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.9rem 1rem;
    background: var(--color-cream);
    color: var(--color-forest);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
    border-top: 1px solid rgba(61, 79, 57, 0.08);
}
.search-view-all:hover { background: var(--color-sage); color: white; }
.search-view-all svg { width: 14px; height: 14px; }

/* לוגו */
.logo {
    flex: 1;
    display: flex;
    justify-content: center;
    transition: all 0.3s ease;
}
.header.scrolled .logo {
    flex: 0 0 auto;
    order: -1;
    margin-left: 0;
}
.logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
/* specificity גבוהה (.header .logo .logo-img) כדי לעקוף את
   .woocommerce-page img { height: auto } של WooCommerce */
.header .logo .logo-img {
    height: 55px;
    width: auto;
    max-width: 220px;
    display: block;
    transition: height 0.3s ease;
    object-fit: contain;
}
.header.scrolled .logo .logo-img { height: 38px; }

/* תמיכה גם בטקסט אם פעם נחזור ל-fallback */
.logo-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-forest);
    transition: font-size 0.3s ease;
}
.header.scrolled .logo-text { font-size: 1.1rem; }
.logo-tagline {
    font-size: 0.6rem;
    color: var(--color-sage);
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}
.header.scrolled .logo-tagline { display: none; }

/* Actions */
.header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 0.2rem; }
.header-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.4rem 0.6rem;
    text-decoration: none;
    color: var(--color-forest);
    border-radius: 8px;
    position: relative;
}
.header-action:hover { background: rgba(122, 139, 111, 0.08); }
.header-action span { font-size: 0.6rem; font-weight: 500; transition: all 0.3s ease; }
.header.scrolled .header-action span { opacity: 0; height: 0; overflow: hidden; }
.action-badge {
    position: absolute;
    top: 0;
    left: 2px;
    background: var(--color-rose-deep);
    color: white;
    font-size: 0.55rem;
    font-weight: 700;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ניווט */
.nav-wrapper {
    display: flex;
    justify-content: center;
    padding: 0.5rem 3rem;
    border-top: 1px solid rgba(61, 79, 57, 0.04);
    transition: all 0.3s ease;
}
.header.scrolled .nav-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    border: none;
}
.main-nav {
    display: flex;
    gap: 2.2rem;
    list-style: none;
    transition: gap 0.3s ease;
}
.header.scrolled .main-nav { gap: 1.2rem; }
.main-nav a {
    text-decoration: none;
    color: var(--color-forest);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    position: relative;
    white-space: nowrap;
}
.header.scrolled .main-nav a { font-size: 0.8rem; }
.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 1.5px;
    background: var(--color-sage);
    transition: width 0.2s ease;
}
.main-nav a:hover::after { width: 100%; }
.main-nav .current-menu-item > a,
.main-nav .current-menu-ancestor > a { color: var(--color-sage); }
.main-nav .current-menu-item > a::after { width: 100%; }
.main-nav li { list-style: none; position: relative; }

/* ========== SUB MENU (דרופדאון) ========== */
.main-nav .sub-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: rgba(250, 247, 242, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(61, 79, 57, 0.12);
    padding: 0.6rem 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 101;
    margin-top: 0.3rem;
}
.main-nav .menu-item-has-children:hover > .sub-menu,
.main-nav .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.main-nav .sub-menu li { margin: 0; }
.main-nav .sub-menu a {
    display: block;
    padding: 0.55rem 1.2rem;
    font-size: 0.82rem;
    white-space: nowrap;
    color: var(--color-forest);
}
.main-nav .sub-menu a::after { display: none; }
.main-nav .sub-menu a:hover {
    background: rgba(122, 139, 111, 0.1);
    color: var(--color-sage-dark);
}

/* חץ קטן ליד פריט עם תת-תפריט */
.main-nav .menu-item-has-children > a::before {
    content: '▾';
    font-size: 0.7rem;
    margin-left: 0.25rem;
    opacity: 0.6;
}

/* תתי-תתי תפריטים (level 3+) */
.main-nav .sub-menu .sub-menu {
    top: 0;
    right: 100%;
    margin-top: 0;
    margin-right: 0.3rem;
}

.nav-badge {
    background: var(--color-rose);
    color: white;
    font-size: 0.55rem;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .header-main { padding: 0.6rem 1.2rem; }
    .header-search { display: none; }
    .header-action span { display: none; }
    .nav-wrapper { padding: 0.4rem 1.2rem; overflow-x: auto; }
    .header.scrolled .nav-wrapper { position: relative; top: auto; left: auto; transform: none; }
    .main-nav { gap: 1rem; }

    /* במובייל - תת תפריט נפתח בקליק (toggle class) */
    .main-nav .sub-menu {
        position: static;
        background: transparent;
        box-shadow: none;
        padding: 0.2rem 0 0.2rem 1rem;
        min-width: 0;
        margin: 0;
        display: none;
    }
    .main-nav .menu-item-has-children.is-open > .sub-menu {
        display: flex;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
}
