/* ==============================
   HEADER - base
   ============================== */

.navbar {
    --nav-glow-x: 50%;
    --nav-glow-y: 50%;
    --nav-glow-opacity: 0;

    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1200px, 92vw);
    box-sizing: border-box;

    background: rgba(0, 0, 0, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 16px;
    border-radius: 14px;
    overflow: hidden;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        width 0.35s ease,
        padding 0.35s ease,
        border-radius 0.35s ease,
        box-shadow 0.35s ease,
        transform 0.35s ease;
    box-shadow: var(--shadow-soft);
}

.navbar::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
}

.navbar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(340px circle at var(--nav-glow-x) var(--nav-glow-y), rgba(222, 115, 67, 0.28), rgba(222, 115, 67, 0) 72%);
    opacity: var(--nav-glow-opacity);
    transition: opacity 0.22s ease;
}

.navbar.scrolled {
    width: min(960px, 80vw);
    padding: 10px 14px;
    border-radius: 50px;
}

.logo,
.logoMobile {
    width: 78px;
    height: 78px;
    object-fit: contain;
}

.logoMobile {
    display: none;
}

.nav-links {
    position: relative;
    z-index: 1;

    display: flex;
    list-style: none;
    margin: 0;
    padding: 0 8px;
    align-items: center;
    justify-content: center;
    gap: 34px;
    min-width: 0;
}

.nav-links,
.nav-links * {
    min-width: 0;
}

.nav-links a {
    font-family: var(--font-display);
    text-decoration: none;
    color: var(--color-light);
    font-size: 22px;
    line-height: 1.1;
    position: relative;
    padding: 8px 0;
    white-space: nowrap;
    overflow-wrap: anywhere;
    transition: transform 0.24s ease, color 0.24s ease;
}

.nav-links a::before,
.nav-links a::after {
    content: "";
    position: absolute;
    height: 2px;
    width: 0;
    background-color: var(--color-primary);
    transition: width 0.24s ease;
}

.nav-links a::before {
    top: 0;
    left: 0;
}

.nav-links a::after {
    right: 0;
    bottom: 0;
}

.nav-links a:hover::before,
.nav-links a:hover::after {
    width: 100%;
}

.logo-link::before,
.logo-link::after {
    display: none !important;
}

.logo-link:hover {
    transform: none !important;
    color: var(--color-light) !important;
}

.nav-item-lang .lang-link {
    font-size: 14px;
    letter-spacing: 0.08em;
    font-weight: 700;
    font-family: var(--font-main);
}

.nav-item-lang .lang-link.is-active {
    color: var(--color-primary);
}

.nav-item-theme {
    display: flex;
    align-items: center;
    direction: ltr;
    unicode-bidi: isolate;
}

.theme-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    direction: ltr;
    unicode-bidi: isolate;
    flex-direction: row;
}

.theme-toggle-input {
    position: absolute;
    left: -9999px;
}

.theme-toggle-ui {
    cursor: pointer;
    display: inline-block;
    position: relative;
    width: 90px;
    height: 50px;
    background: linear-gradient(180deg, #8ad8ff, #67bfef);
    border-radius: 84px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 12px 28px rgba(0, 0, 0, 0.16);
    transition: background-color 220ms cubic-bezier(0.445, 0.05, 0.55, 0.95), transform 0.22s ease, box-shadow 0.22s ease;
    direction: ltr;
    unicode-bidi: isolate;
    writing-mode: horizontal-tb;
}

.theme-toggle-ui:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 16px 34px rgba(0, 0, 0, 0.2);
}

.theme-toggle-input:focus-visible + .theme-toggle-ui {
    outline: 2px solid rgba(222, 115, 67, 0.7);
    outline-offset: 3px;
}

.theme-toggle-handler {
    display: inline-block;
    position: relative;
    z-index: 1;
    top: 3px;
    left: 3px;
    width: 44px;
    height: 44px;
    background: linear-gradient(145deg, #ffd699, #ffbf72);
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
    transition: all 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: rotate(-45deg);
}

.theme-crater {
    position: absolute;
    background-color: #e8cda5;
    opacity: 0;
    transition: opacity 200ms ease-in-out;
    border-radius: 100%;
}

.theme-crater--1 {
    top: 18px;
    left: 10px;
    width: 4px;
    height: 4px;
}

.theme-crater--2 {
    top: 28px;
    left: 22px;
    width: 6px;
    height: 6px;
}

.theme-crater--3 {
    top: 10px;
    left: 25px;
    width: 8px;
    height: 8px;
}

.theme-star {
    position: absolute;
    background-color: #ffffff;
    transition: all 300ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
    border-radius: 50%;
}

.theme-star--1 {
    top: 10px;
    left: 35px;
    z-index: 0;
    width: 30px;
    height: 3px;
}

.theme-star--2 {
    top: 18px;
    left: 28px;
    z-index: 1;
    width: 30px;
    height: 3px;
}

.theme-star--3 {
    top: 27px;
    left: 40px;
    z-index: 0;
    width: 30px;
    height: 3px;
}

.theme-star--4,
.theme-star--5,
.theme-star--6 {
    opacity: 0;
    transition: all 300ms 0ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.theme-star--4 {
    top: 16px;
    left: 11px;
    z-index: 0;
    width: 2px;
    height: 2px;
    transform: translate3d(3px, 0, 0);
}

.theme-star--5 {
    top: 32px;
    left: 17px;
    z-index: 0;
    width: 3px;
    height: 3px;
    transform: translate3d(3px, 0, 0);
}

.theme-star--6 {
    top: 36px;
    left: 28px;
    z-index: 0;
    width: 2px;
    height: 2px;
    transform: translate3d(3px, 0, 0);
}

.theme-toggle-input:checked + .theme-toggle-ui {
    background: linear-gradient(180deg, #5a77b4, #4f669b);
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-toggle-handler {
    background: linear-gradient(145deg, #ffe5b5, #f8d9a0);
    transform: translate3d(40px, 0, 0) rotate(0);
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-crater {
    opacity: 1;
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-star--1 {
    width: 2px;
    height: 2px;
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-star--2 {
    width: 4px;
    height: 4px;
    transform: translate3d(-5px, 0, 0);
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-star--3 {
    width: 2px;
    height: 2px;
    transform: translate3d(-7px, 0, 0);
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-star--4,
.theme-toggle-input:checked + .theme-toggle-ui .theme-star--5,
.theme-toggle-input:checked + .theme-toggle-ui .theme-star--6 {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-star--4 {
    transition: all 300ms 200ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-star--5 {
    transition: all 300ms 300ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.theme-toggle-input:checked + .theme-toggle-ui .theme-star--6 {
    transition: all 300ms 400ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.nav-item-cta .nav-cta {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    font-family: var(--font-main);
    color: #ffffff !important;
    background: linear-gradient(135deg, var(--color-primary), var(--color-rare));
    border-radius: 999px;
    padding: 10px 16px;
    box-shadow: var(--shadow-warm);
}

.nav-item-cta .nav-cta::before,
.nav-item-cta .nav-cta::after {
    display: none;
}

.nav-item-cta .nav-cta:hover {
    transform: translateY(-1px);
    color: #ffffff !important;
}

.mobile-quick-actions {
    display: none;
}

@media (min-width: 761px) {
    .nav-item-lang,
    .nav-item-theme {
        display: none;
    }

    .mobile-quick-actions {
        position: fixed;
        right: 18px;
        bottom: 18px;
        z-index: 1100;
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: flex-end;
    }

    .mobile-fab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        padding: 10px 14px;
        border-radius: 999px;
        text-decoration: none;
        font-family: var(--font-main);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.03em;
        box-shadow: var(--shadow-soft);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .mobile-fab:hover {
        transform: translateY(-1px);
    }

    .mobile-fab-quote {
        color: #ffffff;
        background: linear-gradient(145deg, var(--color-primary), var(--color-rare));
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .mobile-fab-quote:hover {
        color: #ffffff;
    }

    .mobile-lang-switch {
        display: inline-flex;
        flex-direction: column;
        gap: 5px;
        padding: 8px 10px;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: var(--shadow-soft);
        min-width: 118px;
    }

    .mobile-lang-label {
        font-family: var(--font-main);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.08em;
        color: var(--color-rare);
        text-transform: uppercase;
    }

    .mobile-lang-links {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .mobile-lang-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 30px;
        border-radius: 9px;
        border: 1px solid rgba(0, 0, 0, 0.12);
        background: #ffffff;
        color: var(--color-dark);
        text-decoration: none;
        font-family: var(--font-main);
        font-size: 11px;
        font-weight: 700;
        transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    }

    .mobile-lang-link.is-active {
        background: var(--color-primary);
        border-color: var(--color-primary);
        color: #ffffff;
    }

    html[lang="ar"] .mobile-quick-actions {
        left: 18px;
        right: auto;
        align-items: flex-start;
    }
}

/* ==============================
   Breakpoints
   ============================== */

@media (max-width: 1450px) {
    .nav-links {
        gap: 24px;
    }

    .nav-links a {
        font-size: 20px;
    }

    .logo,
    .logoMobile {
        width: 70px;
        height: 70px;
    }

    .navbar.scrolled {
        width: min(900px, 82vw);
    }
}

@media (max-width: 1100px) {
    .nav-links {
        gap: 16px;
    }

    .nav-links a {
        font-size: 18px;
    }

    .navbar.scrolled {
        width: min(860px, 86vw);
    }
}

@media (max-width: 760px) {
    .navbar {
        top: 10px;
        width: min(700px, 94vw);
        border-radius: 16px;
        padding: 10px 12px;
        justify-content: center;
    }

    .navbar.scrolled {
        width: min(700px, 94vw);
        border-radius: 16px;
        padding: 10px 12px;
    }

    .nav-links {
        gap: 12px;
        justify-content: center;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 2px;
        width: 100%;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a {
        font-size: 14px;
        padding: 6px 0;
        white-space: nowrap;
    }

    .nav-item-lang,
    .nav-item-cta {
        display: none;
    }

    .nav-item-theme {
        display: none;
    }

    .logo {
        display: none;
    }

    .logoMobile {
        display: block;
        width: 34px;
        height: 34px;
    }

    .logo-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 4px;
        padding-right: 4px;
    }

    .mobile-quick-actions {
        position: fixed;
        right: 14px;
        bottom: max(14px, env(safe-area-inset-bottom));
        z-index: 1100;

        display: flex;
        flex-direction: column;
        gap: 8px;
        align-items: flex-end;
    }

    .mobile-fab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        padding: 10px 14px;
        border-radius: 999px;
        text-decoration: none;
        font-family: var(--font-main);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.03em;
        box-shadow: var(--shadow-soft);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .mobile-fab:hover {
        transform: translateY(-1px);
    }

    .mobile-fab-quote {
        color: #ffffff;
        background: linear-gradient(145deg, var(--color-primary), var(--color-rare));
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .mobile-fab-quote:hover {
        color: #ffffff;
    }

    .theme-switcher-mobile {
        padding: 2px;
    }

    .mobile-lang-switch {
        display: inline-flex;
        flex-direction: column;
        gap: 5px;
        padding: 8px 10px;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: var(--shadow-soft);
        min-width: 118px;
    }

    .mobile-lang-label {
        font-family: var(--font-main);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.08em;
        color: var(--color-rare);
        text-transform: uppercase;
    }

    .mobile-lang-links {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .mobile-lang-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 30px;
        border-radius: 9px;
        border: 1px solid rgba(0, 0, 0, 0.12);
        background: #ffffff;
        color: var(--color-dark);
        text-decoration: none;
        font-family: var(--font-main);
        font-size: 11px;
        font-weight: 700;
        transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    }

    .mobile-lang-link.is-active {
        background: var(--color-primary);
        border-color: var(--color-primary);
        color: #ffffff;
    }

    body {
        padding-bottom: 132px;
    }
}

html[data-theme="dark"] .mobile-lang-switch {
    background: rgba(18, 16, 15, 0.96);
    border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .mobile-lang-label {
    color: #f4e5d9;
}

html[data-theme="dark"] .mobile-lang-link {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--color-dark);
}

@media (max-width: 420px) {
    .mobile-fab {
        min-height: 38px;
        padding: 9px 12px;
        font-size: 11px;
    }

    .mobile-lang-switch {
        min-width: 160px;
    }

    .mobile-lang-link {
        min-height: 28px;
        font-size: 10px;
    }
}

html[lang="ar"] .nav-links a {
    font-family: "Tajawal", Arial, sans-serif;
}
