/* Custom Header Builder - Frontend Styles */

.chb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row; /* RTL: הפריט הראשון (לוגו) יוצג מימין */
    background-color: #ffffff;
    direction: rtl;
    flex-wrap: wrap;
    gap: 15px;
}

.chb-header-logo {
    flex: 0 0 auto;
    order: 1;
    display: flex;
    align-items: center;
}

.chb-header-logo img {
    display: block;
    height: auto;
}

.chb-site-title {
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
}

.chb-header-menu {
    flex: 1 1 auto;
    order: 2;
    display: flex;
    justify-content: center;
}

.chb-menu-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.chb-menu-list li a {
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.chb-menu-list li a:hover {
    opacity: 0.7;
}

.chb-header-button {
    flex: 0 0 auto;
    order: 3;
    display: flex;
    align-items: center;
}

.chb-cta-button {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: opacity 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
}

.chb-cta-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.chb-mobile-toggle {
    display: none;
}

.chb-cta-button-mobile {
    display: none;
}

/* מובייל: לוגו מימין, אייקון המבורגר משמאל, פתיחה לתפריט נפתח מסודר */
@media (max-width: 767px) {
    .chb-header {
        position: relative;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        padding: 0;
        margin: 0;
    }

    /* התפריט - בצד ימין */
    .chb-header-menu {
        order: 1;
        flex: 1 1 auto;
        display: flex;
        justify-content: flex-start;
        min-width: 0;
    }

    .chb-menu-list {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 14px;
    }

    .chb-menu-list li a {
        font-size: 14px;
    }

    /* הלוגו - בצד שמאל */
    .chb-header-logo {
        order: 2;
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        min-width: 0;
        margin: 0;
    }

    .chb-header-logo img {
        max-width: 110px;
        width: auto;
        height: auto;
        display: block;
    }

    /* הכפתור וההמבורגר - מוסתרים לגמרי במובייל */
    .chb-header-button,
    .chb-mobile-toggle,
    .chb-cta-button-mobile {
        display: none !important;
    }
}

/* ===== כפתור חזרה לראש הדף ===== */
.chb-back-to-top {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    z-index: 9990;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--chb-button-bg, #2e9e2e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.chb-back-to-top.chb-btt-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.chb-back-to-top:hover {
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
    .chb-back-to-top {
        width: 42px;
        height: 42px;
        bottom: 18px;
    }
}
