/* ============================================================
   ترقّى — واجهة الدخول v2
   تصميم شاشة كاملة بأسلوب تطبيقات الموبايل العالمية:
   خلفية كريمية دافئة، حقول بيضاء كبيرة، زر برتقالي ممتلئ.
   يُستخدم في: auth/login.php + auth/password_login.php + auth/register.php
   + auth/forgot_password.php + auth/reset_password.php + auth/verify.php
   + auth/phone_verify.php
   ============================================================ */

:root {
    --av-orange: #FA7017;
    --av-orange-dark: #B54705;
    --av-orange-soft: #FFF1E5;
    --av-navy: #1B2D55;
    --av-navy-deep: #142344;
    --av-ink: #2A3550;
    --av-muted: #8A8078;
    --av-bg: #F0E6DD;
    --av-field-border: #E7DACE;
    --av-white: #FFFFFF;
    --av-danger-bg: #FDECEA;
    --av-danger-border: #F5C6C0;
    --av-danger-ink: #93312B;
    --av-success-bg: #E9F9EF;
    --av-success-border: #C4EED4;
    --av-success-ink: #146C3C;
    --av-radius-field: 18px;
    --av-shadow-soft: 0 2px 10px rgba(27, 45, 85, .06);
}

* {
    box-sizing: border-box;
}

html,
body.auth-v2 {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body.auth-v2 {
    font-family: 'Noto Sans Arabic', 'Noto Sans Arabic', sans-serif;
    background:
        radial-gradient(680px 420px at 100% -10%, rgba(250, 112, 23, .10), transparent 62%),
        radial-gradient(520px 380px at -10% 110%, rgba(27, 45, 85, .06), transparent 58%),
        var(--av-bg);
    color: var(--av-ink);
    display: flex;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
}

.av-screen {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    padding: 22px 22px 40px;
    display: flex;
    flex-direction: column;
}

/* على الشاشات الكبيرة: نُبقي إحساس "شاشة الجوال" بلوح مرتفع خفيف */
@media (min-width: 640px) {
    body.auth-v2 {
        padding: 34px 16px;
        align-items: flex-start;
    }

    .av-screen {
        min-height: 0;
        background: rgba(255, 255, 255, .42);
        border: 1px solid rgba(255, 255, 255, .65);
        border-radius: 34px;
        padding: 26px 30px 40px;
        box-shadow: 0 30px 70px rgba(27, 45, 85, .14);
        backdrop-filter: blur(6px);
    }
}

/* ---------- الشريط العلوي: رجوع + لوقو ---------- */
.av-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
}

.av-back {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--av-white);
    border: 1px solid rgba(231, 218, 206, .8);
    border-radius: 16px;
    color: var(--av-navy);
    font-size: 1rem;
    text-decoration: none;
    box-shadow: var(--av-shadow-soft);
    transition: transform .15s ease, box-shadow .15s ease;
}

.av-back:hover {
    color: var(--av-orange-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(27, 45, 85, .12);
}

.av-top-logo {
    height: 40px;
    width: auto;
    display: block;
}

/* ---------- العنوان ---------- */
.av-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--av-navy);
    margin: 0 0 10px;
    line-height: 1.3;
}

.av-sub {
    font-size: .9rem;
    font-weight: 400;
    color: var(--av-muted);
    margin: 0 0 26px;
    line-height: 1.8;
}

.av-sub strong,
.av-sub a {
    color: var(--av-orange-dark);
    font-weight: 700;
    text-decoration: none;
}

/* ---------- الحقول ---------- */
.av-field {
    margin-bottom: 18px;
}

.av-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--av-navy);
    margin-bottom: 8px;
}

.av-input {
    display: block;
    width: 100%;
    min-height: 58px;
    padding: 15px 18px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--av-ink);
    background: var(--av-white);
    border: 1.5px solid var(--av-field-border);
    border-radius: var(--av-radius-field);
    box-shadow: var(--av-shadow-soft);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.av-input::placeholder {
    color: #B7ACA2;
    font-weight: 400;
}

.av-input:focus {
    border-color: var(--av-orange);
    box-shadow: 0 0 0 4px rgba(250, 112, 23, .14);
}

.av-help {
    font-size: .8rem;
    color: var(--av-muted);
    margin-top: 8px;
    line-height: 1.7;
}

.phone-smart-help-ok {
    color: var(--av-orange-dark) !important;
    font-weight: 600;
}

/* ---------- حقل الهاتف الدولي: الكود يسار الرقم في حاوية واحدة ---------- */
.av-phone {
    direction: ltr;
    display: flex;
    align-items: stretch;
    background: var(--av-white);
    border: 1.5px solid var(--av-field-border);
    border-radius: var(--av-radius-field);
    box-shadow: var(--av-shadow-soft);
    transition: border-color .15s ease, box-shadow .15s ease;
    position: relative;
}

.av-phone:focus-within {
    border-color: var(--av-orange);
    box-shadow: 0 0 0 4px rgba(250, 112, 23, .14);
}

.av-phone .av-phone-code {
    flex: 0 0 96px;
    width: 96px;
    min-height: 55px;
    border: 0;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--av-navy);
    text-align: center;
    border-radius: var(--av-radius-field) 0 0 var(--av-radius-field);
    cursor: pointer;
}

.av-phone .av-phone-sep {
    align-self: center;
    width: 1px;
    height: 26px;
    background: var(--av-field-border);
    flex: 0 0 1px;
}

.av-phone .av-phone-number {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 55px;
    border: 0;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--av-ink);
    padding: 0 16px;
    text-align: left;
    letter-spacing: .3px;
    border-radius: 0 var(--av-radius-field) var(--av-radius-field) 0;
}

.av-phone .av-phone-number::placeholder,
.av-phone .av-phone-code::placeholder {
    color: #B7ACA2;
    font-weight: 400;
    letter-spacing: 0;
}

/* قائمة البحث عن الدول (يحقنها phone_country.js) — نكيّفها مع الهوية */
.av-phone .country-search-menu {
    border: 1.5px solid var(--av-field-border);
    border-radius: 16px;
    box-shadow: 0 24px 55px rgba(27, 45, 85, .18);
}

.av-phone .country-search-option:hover,
.av-phone .country-search-option.is-active {
    background: var(--av-orange-soft);
    color: var(--av-orange-dark);
}

.av-phone .country-search-code {
    color: var(--av-orange-dark);
}

/* ---------- الأزرار ---------- */
.av-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 58px;
    padding: 14px 20px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1.02rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
    position: relative;
}

.av-btn-primary {
    background: var(--av-orange-dark);
    border: none;
    color: #fff;
    box-shadow: 0 12px 26px rgba(250, 112, 23, .35);
    margin-top: 8px;
}

.av-btn-primary:hover {
    background: #923904;
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(250, 112, 23, .42);
}

.av-btn-primary:active {
    transform: translateY(0);
}

.av-btn-ghost {
    background: var(--av-white);
    border: 1.5px solid var(--av-field-border);
    color: var(--av-navy);
    box-shadow: var(--av-shadow-soft);
    font-weight: 600;
    margin-bottom: 12px;
}

.av-btn-ghost:hover {
    border-color: #D9C9BA;
    color: var(--av-navy);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(27, 45, 85, .10);
}

.av-btn-ghost img,
.av-btn-ghost .av-btn-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.av-btn-ghost .av-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--av-orange-dark);
    font-size: 1.05rem;
}

/* سبينر التحميل (auth.js يضيف .loading ويخفي .btn-text) */
.av-btn.loading {
    color: transparent !important;
    pointer-events: none;
}

.av-btn.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.4rem;
    height: 1.4rem;
    margin: -0.7rem 0 0 -0.7rem;
    border: 3px solid rgba(255, 255, 255, .5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: av-spin .7s linear infinite;
}

.av-btn-ghost.loading::after {
    border-color: rgba(27, 45, 85, .25);
    border-top-color: var(--av-navy);
}

@keyframes av-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- فاصل "أو" ---------- */
.av-or {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0 20px;
    color: var(--av-muted);
    font-size: .85rem;
    font-weight: 500;
}

.av-or::before,
.av-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(138, 128, 120, .28);
}

/* ---------- تبويبات بريد / رقم (صفحة الباسورد) ---------- */
.av-tabs {
    display: flex;
    background: rgba(255, 255, 255, .7);
    border: 1.5px solid var(--av-field-border);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 22px;
}

.av-tab {
    flex: 1;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: .92rem;
    font-weight: 600;
    color: var(--av-muted);
    padding: 11px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.av-tab.is-active {
    background: var(--av-navy);
    color: #fff;
    box-shadow: 0 6px 16px rgba(27, 45, 85, .25);
}

/* ---------- حقل كلمة المرور مع زر الإظهار ---------- */
.av-pass {
    position: relative;
}

.av-pass .av-input {
    padding-inline-end: 54px;
}

.av-pass .av-pass-eye {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border: 0;
    background: transparent;
    color: var(--av-muted);
    font-size: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
}

.av-pass .av-pass-eye:hover {
    color: var(--av-orange-dark);
    background: var(--av-orange-soft);
}

/* ---------- التنبيهات ---------- */
.av-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.7;
    margin-bottom: 20px;
    border: 1.5px solid transparent;
}

.av-alert i {
    margin-top: 3px;
    flex: 0 0 auto;
}

.av-alert-danger {
    background: var(--av-danger-bg);
    border-color: var(--av-danger-border);
    color: var(--av-danger-ink);
}

.av-alert-success {
    background: var(--av-success-bg);
    border-color: var(--av-success-border);
    color: var(--av-success-ink);
}

.countdown-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 8px;
    background: var(--av-orange-soft);
    color: var(--av-orange-dark);
    border: 1px solid #F8CFAC;
    font-weight: 700;
    margin-inline-start: 6px;
    direction: ltr;
}

/* ---------- الروابط السفلية ---------- */
.av-links {
    margin-top: 26px;
    text-align: center;
    font-size: .88rem;
    color: var(--av-muted);
    line-height: 2.3;
}

.av-links a {
    color: var(--av-navy);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1.5px solid rgba(250, 112, 23, .45);
    padding-bottom: 1px;
    transition: color .15s ease, border-color .15s ease;
}

.av-links a:hover {
    color: var(--av-orange-dark);
    border-color: var(--av-orange-dark);
}

.av-version {
    display: block;
    margin-top: 12px;
    font-size: .68rem;
    color: #B7ACA2;
    text-align: center;
}

/* ---------- التواصل ---------- */
.av-contact {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(138, 128, 120, .18);
    text-align: center;
    font-size: .85rem;
    color: var(--av-muted);
}

.av-contact a {
    color: var(--av-navy);
    font-weight: 600;
    text-decoration: none;
}

.av-contact a:hover {
    color: var(--av-orange-dark);
}

.av-contact .av-wa {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 20px;
    background: #25D366;
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
    font-size: .88rem;
}

.av-contact .av-wa:hover {
    background: #128C7E;
    color: #fff;
}

/* ---------- شبكة عمودين (الاسم الأول/الأخير، الباسوردين) ---------- */
.av-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 420px) {
    .av-grid-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ---------- اختيار مقسّم (الجنس) ---------- */
.av-seg {
    display: flex;
    background: rgba(255, 255, 255, .7);
    border: 1.5px solid var(--av-field-border);
    border-radius: 999px;
    padding: 4px;
}

.av-seg-opt {
    flex: 1;
    position: relative;
    cursor: pointer;
    margin: 0;
}

.av-seg-opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.av-seg-opt span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 12px 10px;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 600;
    color: var(--av-muted);
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.av-seg-opt input:checked+span {
    background: var(--av-navy);
    color: #fff;
    box-shadow: 0 6px 16px rgba(27, 45, 85, .25);
}

.av-seg-opt input:focus-visible+span {
    outline: 2px solid var(--av-orange);
    outline-offset: 2px;
}

/* ---------- بطاقات اختيار (طريقة التحقق) ---------- */
.av-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 420px) {
    .av-choice-grid {
        grid-template-columns: 1fr;
    }
}

.verification-choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: var(--av-white);
    border: 1.5px solid var(--av-field-border);
    border-radius: var(--av-radius-field);
    box-shadow: var(--av-shadow-soft);
    cursor: pointer;
    margin: 0;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.verification-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.verification-choice:hover {
    border-color: #D9C9BA;
}

.verification-choice.selected,
.verification-choice:has(input:checked) {
    border-color: var(--av-orange);
    background: var(--av-orange-soft);
    box-shadow: 0 0 0 3px rgba(250, 112, 23, .12);
}

.verification-choice .choice-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.15rem;
    color: #fff;
}

.verification-choice .choice-icon.whatsapp {
    background: #21C063;
}

.verification-choice .choice-icon.email {
    background: var(--av-navy);
}

.verification-choice .choice-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.verification-choice .choice-body strong {
    font-size: .95rem;
    color: var(--av-navy);
}

.verification-choice .choice-body small {
    font-size: .76rem;
    color: var(--av-muted);
    line-height: 1.6;
}

/* ---------- تنبيه معلوماتي (الدعوة، الملاحظات) ---------- */
.av-alert-info {
    background: var(--av-orange-soft);
    border-color: #F8CFAC;
    color: #8A4A12;
}

/* ---------- حالات التحقق من الحقول (يستخدمها register.js) ---------- */
.av-input.is-valid {
    border-color: #2EA35F;
}

.av-input.is-invalid {
    border-color: #C0392B;
}

.text-danger {
    color: #C0392B;
}

.text-success {
    color: #1E8E4E;
}

.me-1 {
    margin-inline-end: 4px;
}

/* ---------- موبايل صغير ---------- */
@media (max-width: 380px) {
    .av-screen {
        padding: 18px 16px 32px;
    }

    .av-title {
        font-size: 1.6rem;
    }

    .av-phone .av-phone-code {
        flex-basis: 84px;
        width: 84px;
    }
}

/* ============================================================
   إضافات صفحات OTP / التحقق / إعادة التعيين (verify, phone_verify,
   forgot_password, reset_password) — نفس هوية v2
   ============================================================ */

/* أدوات مساعدة صغيرة (بدل Bootstrap) */
.d-none {
    display: none !important;
}

/* شاشة متمركزة للـ OTP */
.av-screen.av-centered {
    justify-content: flex-start;
    text-align: center;
}

.av-hero-icon {
    width: 76px;
    height: 76px;
    margin: 6px auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    font-size: 2rem;
    color: #fff;
    box-shadow: 0 14px 30px rgba(27, 45, 85, .18);
}

.av-hero-icon.is-whatsapp {
    background: #21C063;
    box-shadow: 0 14px 30px rgba(33, 192, 99, .32);
}

.av-hero-icon.is-mail {
    background: var(--av-navy);
}

.av-hero-icon.is-key {
    background: var(--av-orange);
    box-shadow: 0 14px 30px rgba(250, 112, 23, .32);
}

.av-centered .av-title {
    text-align: center;
}

.av-dest {
    font-size: .95rem;
    color: var(--av-muted);
    line-height: 1.9;
    margin: 0 0 24px;
}

.av-dest strong {
    display: inline-block;
    margin-top: 4px;
    color: var(--av-navy);
    font-weight: 800;
    font-size: 1.05rem;
}

/* حقل رمز OTP */
.av-otp {
    text-align: center;
    letter-spacing: .65rem;
    font-size: 1.55rem;
    font-weight: 800;
    direction: ltr;
    padding-inline: 14px;
    color: var(--av-navy);
}

.av-otp::placeholder {
    letter-spacing: .5rem;
    color: #D8CBBE;
    font-weight: 600;
}

/* زر إعادة الإرسال */
.av-resend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(138, 128, 120, .18);
    color: var(--av-muted);
    font-size: .9rem;
}

.av-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: .92rem;
    font-weight: 700;
    color: var(--av-navy);
    cursor: pointer;
    padding: 6px 4px;
    border-bottom: 1.5px solid rgba(250, 112, 23, .45);
    transition: color .15s ease, border-color .15s ease;
}

.av-btn-text:hover {
    color: var(--av-orange-dark);
    border-color: var(--av-orange-dark);
}

.av-btn-text:disabled {
    color: #B7ACA2;
    border-color: transparent;
    cursor: default;
}

.count-badge,
.av-count {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 2px 9px;
    border-radius: 8px;
    background: var(--av-orange-soft);
    color: var(--av-orange-dark);
    border: 1px solid #F8CFAC;
    font-weight: 700;
    font-size: .82rem;
    direction: ltr;
}

/* أدوات كلمة المرور (توليد/نسخ/مقياس القوة) في reset_password */
.av-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 2px 0 8px;
}

.av-tool-btn {
    border: 1.5px solid var(--av-field-border);
    background: #fff;
    border-radius: 999px;
    padding: 8px 15px;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    color: var(--av-navy);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.av-tool-btn:hover {
    border-color: var(--av-orange);
    color: var(--av-orange-dark);
    background: var(--av-orange-soft);
}

.av-badge-soft {
    background: var(--av-success-bg);
    color: var(--av-success-ink);
    border-radius: 8px;
    padding: 4px 11px;
    font-size: .78rem;
    font-weight: 700;
}

.av-pwd-meter {
    height: 6px;
    border-radius: 4px;
    background: #EFE4D8;
    overflow: hidden;
    margin: 2px 0 6px;
}

.av-pwd-meter>div {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width .3s ease, background .3s ease;
}

/* زر إظهار/إخفاء نصي داخل حقل كلمة المرور (reset_password) */
.av-pass .toggle-eye {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--av-muted);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 7px 11px;
    border-radius: 10px;
    transition: color .15s ease, background .15s ease;
}

.av-pass .toggle-eye:hover {
    color: var(--av-orange-dark);
    background: var(--av-orange-soft);
}

.av-pass:has(.toggle-eye) .av-input {
    padding-inline-end: 68px;
}

.av-note-between {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.av-note-between .av-inline-note {
    font-size: .76rem;
    color: var(--av-muted);
    font-weight: 500;
}

.av-policy { margin: 1rem 0; font-size: .85rem; line-height: 1.9; color: var(--av-muted); }
