:root {
    --header-bg: #ffffff;
    --header-text: #1f2937;
    --header-muted: #7b8794;
    --header-border: #e7ebf0;
    --header-accent: #e0a12f;
    --header-accent-dark: #c98d20;
    --header-dark: #192334;
    --header-soft: #f8fafc;
    --header-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    --dropdown-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
}

.site-header__inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    flex-shrink: 0;
    min-width: 260px;
}

.site-brand__logo {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, #f0b541, #d9961a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(224, 161, 47, 0.24);
    flex-shrink: 0;
}

.site-brand__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-brand__logo-fallback {
    color: #1f2937;
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
}

.site-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.site-brand__text strong {
    font-size: 2.2rem;
    font-weight: 900;
    color: #1f2937;
    letter-spacing: -0.02em;
}

.site-brand__text small {
    margin-top: 6px;
    color: var(--header-muted);
    font-size: 1rem;
}

.site-nav {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: flex-start; /* في RTL = يبدأ من اليمين */
    margin: 0 12px;
}

.site-nav__list {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* في RTL = من اليمين */
    gap: 34px;
    margin: 0;
    padding: 0;
    width: auto; /* مهم حتى لا تتمدد القائمة وتبدو في الوسط */
}

/* هنا صار بدء القائمة من اليمين داخل مساحة الناف */
.site-nav__item {
    position: relative;
    flex: 0 0 auto;
}
.site-nav__item:first-child {
    margin-right: 0;
}

.site-nav__link {
    color: var(--header-text);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 10px 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color .2s ease;
    white-space: nowrap;
}

.site-nav__link:hover {
    color: var(--header-accent-dark);
}

.dropdown-arrow {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    transform: translateY(1px);
}

.site-nav__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--header-border);
    border-radius: 18px;
    box-shadow: var(--dropdown-shadow);
    list-style: none;
    margin: 0;
    padding: 10px;
    display: none;
}

/* جسر صغير يمنع مشكلة الفراغ */
.site-nav__dropdown::before {
    content: "";
    position: absolute;
    top: -10px;
    right: 0;
    width: 100%;
    height: 12px;
}

.site-nav__item:hover > .site-nav__dropdown,
.site-nav__item:focus-within > .site-nav__dropdown {
    display: block;
}

.site-nav__dropdown li + li {
    margin-top: 4px;
}

.site-nav__dropdown-link {
    display: block;
    text-decoration: none;
    color: var(--header-text);
    font-size: 0.96rem;
    font-weight: 600;
    padding: 11px 12px;
    border-radius: 12px;
    transition: background .2s ease, color .2s ease;
}

.site-nav__dropdown-link:hover {
    background: #f8fafc;
    color: var(--header-accent-dark);
}

.site-auth {
    position: relative;
    flex-shrink: 0;
}

.site-auth__button {
    border: 0;
    background: linear-gradient(135deg, #1d2738, #243248);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    padding: 14px 18px;
    border-radius: 18px;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 12px 22px rgba(25, 35, 52, 0.18);
}

.site-auth__button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(25, 35, 52, 0.22);
}

.site-auth__icon,
.site-auth__caret {
    width: 18px;
    height: 18px;
    display: inline-flex;
    color: #f0b541;
}

.site-auth__icon svg,
.site-auth__caret svg,
.auth-input-icon svg {
    width: 100%;
    height: 100%;
}

.site-auth__label {
    line-height: 1;
}

.auth-popover {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 360px;
    background: #fff;
    border: 1px solid var(--header-border);
    border-radius: 22px;
    box-shadow: var(--dropdown-shadow);
    padding: 18px;
    display: none;
}

/* هذا أهم سطرين لحل صعوبة الضغط */
.auth-popover::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 14px;
}

.site-auth.is-open .auth-popover {
    display: block;
}

.auth-popover__top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #edf1f5;
}

.auth-popover__avatar {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffd26a, #f0b541);
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.35rem;
    box-shadow: 0 8px 18px rgba(240, 181, 65, 0.26);
}

.auth-popover__intro {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-popover__intro strong {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 800;
}

.auth-popover__intro span {
    color: #6b7280;
    font-size: 0.92rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field label {
    color: #374151;
    font-size: 0.92rem;
    font-weight: 700;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #8a94a6;
    pointer-events: none;
}

.auth-input-wrap input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #dbe3ea;
    background: #f8fafc;
    border-radius: 14px;
    padding: 13px 42px 13px 14px;
    font-size: 0.96rem;
    color: #1f2937;
    outline: none;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.auth-input-wrap input:focus {
    border-color: #f0b541;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(240, 181, 65, 0.12);
}

.auth-submit {
    border: 0;
    background: linear-gradient(135deg, #f0b541, #df9f2d);
    color: #1f2937;
    font-size: 1rem;
    font-weight: 900;
    padding: 13px 16px;
    border-radius: 14px;
    cursor: pointer;
    transition: transform .2s ease, opacity .2s ease;
    margin-top: 4px;
}

.auth-submit:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.auth-links a {
    color: #4b5563;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 700;
    transition: color .2s ease;
}

.auth-links a:hover {
    color: var(--header-accent-dark);
}

.mobile-nav-toggle {
    display: none;
    border: 0;
    background: #f3f4f6;
    color: #1f2937;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.3rem;
}

@media (max-width: 1100px) {
    .site-header__inner {
        flex-wrap: wrap;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .site-nav {
        order: 4;
        width: 100%;
        display: none;
        margin: 8px 0 0;
    }

    .site-nav.is-open {
        display: block;
    }

    .site-nav__list {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .site-nav__link {
        justify-content: space-between;
        padding: 12px 14px;
        border-radius: 12px;
        background: #f8fafc;
    }

    .site-nav__dropdown {
        position: static;
        display: block;
        box-shadow: none;
        border: 0;
        background: transparent;
        padding: 6px 0 0;
        min-width: auto;
    }

    .site-nav__dropdown::before {
        display: none;
    }

    .site-nav__dropdown-link {
        background: #fff;
        border: 1px solid #eef2f7;
    }

    .site-brand__text strong {
        font-size: 1.8rem;
    }
}

@media (max-width: 700px) {
    .site-brand {
        min-width: 0;
    }

    .site-brand__text strong {
        font-size: 1.55rem;
    }

    .site-brand__text small {
        font-size: 0.9rem;
    }

    .site-auth {
        width: 100%;
    }

    .site-auth__button {
        width: 100%;
        justify-content: center;
    }

    .auth-popover {
        width: min(100%, 360px);
        left: auto;
        right: 0;
    }
}

.site-auth__button--logged {
    background: linear-gradient(135deg, #17324a, #21425f);
}

.auth-popover--logged {
    width: 280px;
}

.auth-user-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-user-link {
    display: block;
    text-decoration: none;
    color: #1f2937;
    font-size: 0.96rem;
    font-weight: 700;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #ebf0f5;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.auth-user-link:hover {
    background: #eef4f9;
    color: #c98d20;
    transform: translateY(-1px);
}

.auth-user-link--danger {
    color: #b42318;
    background: #fff5f5;
    border-color: #f3d0d0;
}

.auth-user-link--danger:hover {
    color: #912018;
    background: #ffecec;
}

/* ===== Header polish ===== */
.site-header {
    backdrop-filter: saturate(180%) blur(10px);
}

.site-header__inner {
    max-width: 1320px;
    padding: 14px 24px;
    justify-content: space-between;
}

.site-brand {
    min-width: auto;
}

.site-header__inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    justify-content: space-between;
}

.site-brand {
    min-width: auto;
    flex-shrink: 0;
}

.site-nav {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: flex-start; /* في RTL = يبدأ من اليمين */
    margin: 0 24px 0 0;
}

.site-nav__list {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* في RTL = من اليمين */
    gap: 24px;
    margin: 0;
    padding: 0;
    width: 100%;
}

.site-auth {
    flex-shrink: 0;
    margin-right: auto; /* يدفع زر الدخول إلى اليسار */
}
.site-nav__link {
    padding: 12px 14px;
    border-radius: 14px;
}

.site-nav__item:hover > .site-nav__link,
.site-nav__item:focus-within > .site-nav__link {
    background: #f8fafc;
    color: var(--header-accent-dark);
}

.site-nav__dropdown {
    top: calc(100% + 10px);
    right: 0;
    min-width: 250px;
    padding: 12px;
}

.site-nav__dropdown li + li {
    margin-top: 6px;
}

.site-nav__dropdown-link {
    padding: 12px 14px;
    border: 1px solid transparent;
}

.site-nav__dropdown-link:hover {
    background: #fffaf1;
    border-color: #f4dfb4;
}

.site-auth__button {
    min-height: 52px;
    padding-inline: 18px;
    border-radius: 16px;
}

.auth-popover {
    right: 0;
    left: auto;
    width: 380px;
    padding: 20px;
}

.auth-submit {
    margin-top: 8px;
}

.auth-links {
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid #edf1f5;
    align-items: center;
}

.auth-links a {
    display: inline-flex;
    align-items: center;
}

.auth-link-primary {
    color: #1f2937;
}

.auth-link-secondary {
    color: #6b7280;
}

.auth-link-primary:hover,
.auth-link-secondary:hover {
    color: var(--header-accent-dark);
}

@media (max-width: 1100px) {
    .site-header__inner {
        gap: 14px;
    }

    .site-nav {
        margin: 10px 0 0;
    }

    .site-nav__list {
        width: 100%;
        gap: 8px;
    }

    .site-nav__item {
        width: 100%;
    }

    .site-nav__dropdown {
        min-width: auto;
    }
}

@media (max-width: 700px) {
    .auth-popover {
        width: min(100%, 360px);
    }

    .auth-links {
        gap: 10px;
    }
}