/* ==========================================================================
   Hyper — Guest auth styles (login / register / password recovery)
   Source of truth: mockup/hyper_login_desktop_almarai_v2_button.html
                    mockup/hyper_register_desktop_v1.html

   All selectors are scoped to body.hp-page so this stylesheet cannot
   leak into authenticated pages if loaded by accident.
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/npm/@fontsource/almarai/index.css');

body.hp-page {
    margin: 0;
    padding: 0;
    direction: rtl;
    background: #FAFAF8;
    color: #111827;
    font-family: "Almarai", "Cairo", "Tajawal", "SF Arabic", "Segoe UI", "Noto Sans Arabic", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.hp-page,
body.hp-page *,
body.hp-page *::before,
body.hp-page *::after { box-sizing: border-box; }

/* Belt-and-braces: the * selector above matches descendants, this rule
   makes sure the body itself also gets border-box. */

body.hp-page[dir="ltr"] {
    font-family: "Almarai", "Inter", "Segoe UI", system-ui, sans-serif;
}

/* ---------- Top nav ---------- */
.hp-topnav {
    height: 60px;
    padding: 0 36px;
    background: #fff;
    border-bottom: 1px solid #EFEDE8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.hp-topnav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.hp-topnav-logo {
    width: 32px; height: 32px;
    border-radius: 9px;
    overflow: hidden;
    display: block;
    flex-shrink: 0;
    object-fit: contain;
    background: #fff;
}
.hp-topnav-name {
    font-size: 15px; font-weight: 700;
    color: #111827; letter-spacing: -0.01em;
}
.hp-topnav-right { display: flex; align-items: center; gap: 18px; }
.hp-help-link {
    font-size: 13px; font-weight: 400;
    color: #6B7280; text-decoration: none;
    display: flex; align-items: center; gap: 6px;
    transition: color 150ms ease;
}
.hp-help-link:hover { color: #111827; }
.hp-lang {
    display: inline-flex;
    background: #F4F4F5;
    border: 1px solid #ECEAE4;
    border-radius: 999px;
    padding: 3px;
}
/* The toggle is two POST <form>s. display:contents flattens them so the
   nested <button>s lay out as direct children of the pill. */
.hp-lang form {
    margin: 0;
    padding: 0;
    display: contents;
}
.hp-lang button {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 400;
    color: #6B7280;
    font-family: inherit;
    line-height: 1.4;
    transition: background-color 150ms ease, color 150ms ease;
}
.hp-lang button.on { background: #1F2937; color: #fff; font-weight: 700; }
.hp-lang button:not(.on):hover { color: #111827; }
.hp-lang button:focus-visible {
    outline: 2px solid rgba(31, 41, 55, 0.4);
    outline-offset: 2px;
}

/* ---------- Main / card ---------- */
.hp-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}
.hp-card {
    background: #fff;
    border: 1px solid #EDEAE3;
    border-radius: 18px;
    padding: 44px 44px 32px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03),
                0 12px 32px rgba(15, 23, 42, 0.04);
}
.hp-card--register {
    max-width: 480px;
    padding: 40px 44px 30px;
}

/* ---------- Brand block ---------- */
.hp-brand {
    display: flex; flex-direction: column;
    align-items: center; gap: 14px;
    margin-bottom: 26px;
}
.hp-card--register .hp-brand { gap: 12px; margin-bottom: 22px; }
.hp-logo {
    width: 64px; height: 64px;
    border-radius: 18px;
    overflow: hidden;
    display: block;
    object-fit: contain;
    background: #fff;
}
.hp-card--register .hp-logo { width: 60px; height: 60px; }
.hp-brand-text { display: flex; flex-direction: column; align-items: center; }
.hp-brand-name {
    font-size: 22px; font-weight: 700;
    color: #111827; letter-spacing: -0.01em;
    line-height: 1.2;
}
.hp-card--register .hp-brand-name { font-size: 20px; }
.hp-brand-tag {
    font-size: 12.5px; font-weight: 400;
    color: #9CA3AF; margin-top: 2px;
}
.hp-card--register .hp-brand-tag { font-size: 12px; }

/* ---------- Title ---------- */
.hp-title-block { text-align: center; margin-bottom: 26px; }
.hp-card--register .hp-title-block { margin-bottom: 24px; }
.hp-title {
    font-size: 24px; font-weight: 700;
    color: #111827; letter-spacing: -0.01em;
    margin: 0 0 6px;
}
.hp-card--register .hp-title { font-size: 22px; }
.hp-sub {
    font-size: 13px; font-weight: 400;
    color: #6B7280;
    margin: 0;
}

/* ---------- Form fields ---------- */
.hp-form { display: flex; flex-direction: column; gap: 14px; }
.hp-field { display: flex; flex-direction: column; gap: 6px; }
.hp-label {
    font-size: 12.5px; font-weight: 400;
    color: #1F2937;
    display: flex; align-items: center; gap: 4px;
}
.hp-label .req { color: #EF4444; font-size: 12px; }

.hp-input-wrap {
    display: flex; align-items: center; gap: 10px;
    height: 46px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.hp-input-wrap:focus-within,
.hp-input-wrap.focused {
    border-color: #F97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}
.hp-input-wrap.has-error {
    border-color: #EF4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.10);
}
.hp-input-wrap > i {
    color: #9CA3AF;
    font-size: 18px;
    flex-shrink: 0;
}
.hp-input-wrap input {
    flex: 1; min-width: 0;
    border: 0; outline: 0;
    background: transparent;
    font-size: 14px; font-weight: 400;
    color: #111827;
    direction: rtl;
    text-align: right;
    font-family: inherit;
    padding: 0;
    margin: 0;
}
body.hp-page[dir="ltr"] .hp-input-wrap input {
    direction: ltr;
    text-align: left;
}
.hp-input-wrap input::placeholder {
    color: #9CA3AF; font-weight: 400;
}

/* Real <button> for password visibility toggle (a11y) */
.hp-eye-btn {
    flex-shrink: 0;
    width: 28px; height: 28px;
    padding: 0; margin: 0;
    border: 0;
    background: transparent;
    color: #9CA3AF;
    display: inline-flex;
    align-items: center; justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: color 150ms ease, background-color 150ms ease;
    font: inherit;
}
.hp-eye-btn i { font-size: 18px; line-height: 1; }
.hp-eye-btn:hover { color: #6B7280; background: rgba(0, 0, 0, 0.03); }
.hp-eye-btn:focus-visible {
    outline: 2px solid rgba(249, 115, 22, 0.5);
    outline-offset: 1px;
    color: #6B7280;
}

.hp-help-text {
    font-size: 11.5px; font-weight: 400;
    color: #9CA3AF;
    margin-top: 2px;
}
.hp-error-text {
    font-size: 12px;
    color: #DC2626;
    margin-top: 2px;
}

/* ---------- Forgot password row ---------- */
.hp-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: 2px;
}
.hp-forgot {
    font-size: 13px; font-weight: 400;
    color: #F97316;
    text-decoration: none;
    transition: color 150ms ease;
}
.hp-forgot:hover { color: #EA6C0B; }
.hp-forgot:focus-visible {
    outline: 2px solid rgba(249, 115, 22, 0.4);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Form alert (top of card) ---------- */
.hp-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 10px;
    color: #B91C1C;
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.5;
}
.hp-alert > i { font-size: 16px; color: #DC2626; flex-shrink: 0; margin-top: 2px; }
.hp-alert .hp-alert-body { flex: 1; min-width: 0; }
.hp-alert .hp-alert-action {
    margin-inline-start: auto;
    background: transparent;
    color: #B91C1C;
    border: 1px solid #FCA5A5;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px; font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}
.hp-alert .hp-alert-action:hover { background: #FCA5A5; color: #fff; }
.hp-alert.is-hidden { display: none; }

.hp-alert--success {
    background: #F0FDF4;
    border-color: #BBF7D0;
    color: #15803D;
}
.hp-alert--success > i { color: #16A34A; }
.hp-alert--success .hp-alert-action {
    color: #15803D;
    border-color: #86EFAC;
}
.hp-alert--success .hp-alert-action:hover { background: #86EFAC; color: #fff; }

/* ---------- Real Google reCAPTCHA widget container ---------- */
.hp-captcha-wrap {
    margin-top: 6px;
    display: flex;
    justify-content: center;
    min-height: 78px;
}
.hp-captcha-wrap .g-recaptcha,
.hp-captcha-wrap > div { transform-origin: top center; }
@media (max-width: 360px) {
    /* Compact-fit the widget on very narrow viewports */
    .hp-captcha-wrap .g-recaptcha,
    .hp-captcha-wrap > div { transform: scale(0.9); }
}

/* ---------- Primary button ---------- */
.hp-btn {
    margin-top: 14px;
    height: 52px;
    border: 0;
    border-radius: 12px;
    background: #F97316;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(249, 115, 22, 0.28),
                0 6px 16px rgba(249, 115, 22, 0.22);
    transition: background 150ms ease, box-shadow 200ms ease, transform 120ms ease;
}
.hp-card--register .hp-btn { margin-top: 18px; }
.hp-btn .arrow { display: inline-flex; transition: transform 200ms ease; }
.hp-btn:hover:not(:disabled) {
    background: #EA6C0B;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.36),
                0 12px 24px rgba(249, 115, 22, 0.32);
    transform: translateY(-1px);
}
.hp-btn:hover:not(:disabled) .arrow { transform: translateX(-3px); }
.hp-btn:active:not(:disabled) {
    background: #C2410C;
    box-shadow: 0 1px 2px rgba(249, 115, 22, 0.22);
    transform: translateY(0);
}
.hp-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.35),
                0 6px 16px rgba(249, 115, 22, 0.22);
}
.hp-btn:disabled { cursor: not-allowed; opacity: 0.95; }
.hp-btn.is-loading { pointer-events: none; }
.hp-btn.is-loading .hp-btn-label,
.hp-btn.is-loading .arrow { visibility: hidden; }
.hp-btn.is-loading::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 20px; height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: hp-spin 0.7s linear infinite;
}
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* ---------- Terms text (register) ---------- */
.hp-terms {
    font-size: 11.5px; font-weight: 400;
    color: #9CA3AF;
    text-align: center;
    margin-top: 14px;
    line-height: 1.6;
}
.hp-terms a {
    color: #6B7280;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.hp-terms a:hover { color: #1F2937; }

/* ---------- Divider + signup link ---------- */
.hp-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 26px 0 14px;
    font-size: 12px; font-weight: 400;
    color: #9CA3AF;
}
.hp-card--register .hp-divider { margin: 22px 0 14px; }
.hp-divider::before, .hp-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #EDEDED;
}
.hp-signup {
    text-align: center;
    font-size: 13px; font-weight: 400;
    color: #6B7280;
    margin: 0;
}
.hp-signup a {
    color: #F97316;
    font-weight: 700;
    text-decoration: none;
    transition: color 150ms ease;
}
.hp-signup a:hover { color: #EA6C0B; }

/* ---------- Footer ---------- */
.hp-pagefoot {
    height: 52px;
    padding: 0 36px;
    background: #fff;
    border-top: 1px solid #EFEDE8;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 11.5px; font-weight: 400;
    color: #9CA3AF;
    flex-shrink: 0;
}
.hp-foot-left { display: flex; align-items: center; gap: 8px; }
.hp-foot-right { display: flex; align-items: center; gap: 18px; }
.hp-foot-right a { color: #9CA3AF; text-decoration: none; transition: color 150ms ease; }
.hp-foot-right a:hover { color: #6B7280; }
.hp-zatca-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    font-size: 11px;
    color: #6B7280;
}

/* ---------- Responsive ---------- */
@media (max-width: 540px) {
    .hp-topnav { padding: 0 18px; }
    .hp-pagefoot {
        padding: 12px 18px;
        height: auto;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .hp-main { padding: 28px 16px; }
    .hp-card { padding: 30px 24px 24px; border-radius: 16px; }
    .hp-card--register { padding: 30px 24px 24px; }
}

/* ---------- Accessibility ---------- */
.hp-sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
