/* ==========================================================
   FormBuilder — Header
   Matches site .container grid (max-width 1350px centered)
   ========================================================== */

/* ── Full-width bar ── */
.fb-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 990;
    background: #fff;
    transition: box-shadow .3s;
}

.fb-header.fixed {
    box-shadow: 0 2px 20px rgba(0,0,0,.06);
}

/* ── Inner: wider than page .container for breathing room ── */
.fb-header-inner {
    display: flex;
    align-items: center;
    height: 80px;
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 20px;
    transition: height .3s ease;
}

.fb-header.fixed .fb-header-inner {
    height: 65px;
}

/* ── Logo ── */
.fb-header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.fb-header-logo-img {
    height: 30px;
    width: auto;
    transition: height .3s ease;
}

.fb-header.fixed .fb-header-logo-img {
    height: 26px;
}

/* ── Body: nav + actions, fills remaining space ── */
.fb-header-body {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    margin-left: 0;
}

/* ── Nav links ── */
.fb-nav {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.fb-nav .nav-item .nav-link,
.fb-nav .nav-item > a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    transition: color .2s, background .2s;
    white-space: nowrap;
    position: relative;
}

.fb-nav .nav-item .nav-link:hover,
.fb-nav .nav-item.active .nav-link,
.fb-nav .nav-item > a:hover {
    color: #111;
    background: rgba(0,0,0,.04);
    text-decoration: none;
}

/* ── Actions: pushed to far right ── */
.fb-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
}

.fb-header-auth {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fb-header-login {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .01em;
    color: #444;
    text-decoration: none;
    padding: 7px 18px;
    border: 1.5px solid #e0e0e0;
    border-radius: 50px;
    background: transparent;
    transition: color .25s, border-color .25s, background .25s;
    white-space: nowrap;
}

.fb-header-login:hover {
    color: #111;
    border-color: #ccc;
    background: #f7f7f7;
    text-decoration: none;
}

.fb-header-signup {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .01em;
    color: #fff;
    text-decoration: none;
    padding: 7px 20px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #FFBA12 0%, #F59E0B 100%);
    box-shadow: 0 2px 8px rgba(255, 186, 18, .25);
    transition: transform .25s, box-shadow .25s, filter .25s;
    white-space: nowrap;
}

.fb-header-signup:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 186, 18, .35);
    filter: brightness(1.05);
    color: #fff;
    text-decoration: none;
}

.fb-header-signup:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 186, 18, .2);
}

/* ── Language dropdown ── */
.fb-lang-dropdown {
    position: relative;
}

.fb-lang-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 20px;
    transition: background .2s;
}

.fb-lang-btn:hover {
    background: rgba(0,0,0,.04);
}

.fb-lang-flag {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.fb-lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.1);
    padding: 6px;
    z-index: 999;
    min-width: 150px;
}

.fb-lang-dropdown.open .fb-lang-menu {
    display: block;
}

.fb-lang-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s;
}

.fb-lang-item:hover {
    background: #f5f5f5;
    text-decoration: none;
    color: #333;
}

.fb-lang-item.active {
    background: #fff8e6;
    color: #d9a000;
}

.fb-lang-item img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

/* ── Burger (hidden on desktop) ── */
.fb-header-burger {
    display: none;
}

/* ==========================================================
   Mobile (< 992px)
   ========================================================== */
@media (max-width: 991px) {
    .fb-header-inner {
        height: 65px;
        flex-wrap: wrap;
        padding: 0 15px;
    }

    .fb-header-logo-img {
        height: 26px;
    }

    /* Burger */
    .fb-header-burger {
        display: block;
        width: 44px;
        height: 38px;
        background: #FFBA12;
        border: none;
        border-radius: 5px;
        position: relative;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(255,186,18,.25);
    }

    .fb-header-burger span,
    .fb-header-burger::before,
    .fb-header-burger::after {
        content: '';
        position: absolute;
        left: 9px;
        width: 26px;
        height: 2px;
        background: #fff;
        transition: transform .25s, opacity .25s;
    }

    .fb-header-burger span {
        top: 50%;
        transform: translateY(-50%);
    }

    .fb-header-burger::before {
        top: 50%;
        transform: translateY(calc(-50% - 8px));
    }

    .fb-header-burger::after {
        top: 50%;
        transform: translateY(calc(-50% + 8px));
    }

    .fb-header-burger.open span { opacity: 0; }
    .fb-header-burger.open::before { transform: translateY(-50%) rotate(45deg); }
    .fb-header-burger.open::after { transform: translateY(-50%) rotate(-45deg); }

    /* Collapsible body */
    .fb-header-body {
        display: none;
        width: 100%;
        order: 3;
        flex-direction: column;
        flex: none;
        margin-left: 0;
        padding-bottom: 16px;
    }

    .fb-header-body.open {
        display: flex;
    }

    /* Nav stacked */
    .fb-nav {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .fb-nav .nav-item {
        width: 100%;
    }

    .fb-nav .nav-item .nav-link,
    .fb-nav .nav-item > a {
        padding: 12px 0;
        border-radius: 0;
        border-bottom: 1px solid #f0f0f0;
        justify-content: space-between;
        font-size: 16px;
    }

    .fb-nav .nav-item .nav-link:hover,
    .fb-nav .nav-item > a:hover {
        background: none;
    }

    /* Actions on mobile */
    .fb-header-actions {
        flex-direction: column;
        width: 100%;
        margin-left: 0;
        padding-top: 16px;
        gap: 10px;
    }

    .fb-header-auth {
        width: 100%;
        gap: 10px;
    }

    .fb-header-login {
        flex: 1;
        text-align: center;
        padding: 10px;
        border: 1px solid #eee;
        border-radius: 8px;
    }

    .fb-header-signup {
        flex: 1;
        text-align: center;
        padding: 10px;
    }

    .fb-lang-dropdown {
        align-self: center;
    }

    .fb-lang-menu {
        top: auto;
        bottom: 100%;
        margin-top: 0;
        margin-bottom: 8px;
    }
}

/* ==========================================================
   RTL (Arabic)
   ========================================================== */
[dir="rtl"] .fb-header-inner {
    flex-direction: row-reverse;
}

[dir="rtl"] .fb-header-body {
    margin-left: 0;
    margin-right: 0;
    flex-direction: row-reverse;
}

[dir="rtl"] .fb-header-actions {
    flex-direction: row-reverse;
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .fb-nav {
    flex-direction: row-reverse;
}

[dir="rtl"] .fb-lang-menu {
    right: auto;
    left: 0;
}

@media (max-width: 991px) {
    [dir="rtl"] .fb-header-body {
        margin-right: 0;
        flex-direction: column;
    }
    [dir="rtl"] .fb-header-actions {
        flex-direction: column;
        margin-right: 0;
    }
    [dir="rtl"] .fb-nav {
        flex-direction: column;
    }
}
