/* Activation Modal Styles */
/* أنماط نافذة التفعيل */

:root {
    --activation-space-sm: clamp(8px, 2vw, 14px);
    --activation-space-md: clamp(14px, 3vw, 20px);
    --activation-space-lg: clamp(20px, 5vw, 32px);
    --activation-text-sm: clamp(0.88rem, 2.3vw, 0.96rem);
    --activation-text-md: clamp(1rem, 2.6vw, 1.1rem);
    --activation-text-lg: clamp(1.25rem, 3.8vw, 1.55rem);
    --activation-radius: clamp(14px, 2.5vw, 20px);
}

/* Darken background without blur */
body.activation-modal-open > *:not(.activation-modal-overlay):not(.admin-modal-overlay):not(.admin-portal-root) {
    pointer-events: none;
    user-select: none;
}

/* نوافذ مباشرة تحت body (لوحة التحكم: خروج / تأكيد حذف) — يجب أن تبقى قابلة للنقر */
body.activation-modal-open > .activation-modal-overlay,
body.activation-modal-open > .admin-modal-overlay {
    pointer-events: auto !important;
}

body.activation-modal-open {
    overflow: hidden;
}

html.activation-modal-open {
    overflow: hidden !important;
}

/* Modal Overlay */
.activation-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 9, 12, 0.78);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--activation-space-md);
    z-index: 10000;
}

/* Modal Container */
.activation-modal-container {
    width: min(440px, 90vw);
    min-width: 0;
    background: rgba(20, 20, 20, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--activation-radius);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.52);
    position: relative;
    overflow: hidden;
    padding: clamp(16px, 3.5vw, 24px);
}

/* Modal Content */
.activation-modal-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--activation-space-md);
}

.activation-logo img {
    filter: none;
}

.activation-step {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* السمة hidden لا تخفي العنصر إذا فرضنا display:flex أعلاه — يجب إعادة none صراحة */
.activation-modal-overlay [hidden],
#loginModalOverlay [hidden] {
    display: none !important;
}

/* Title */
.activation-title {
    font-family: 'RTL', sans-serif;
    font-size: var(--activation-text-lg);
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    text-align: center;
}

/* Subtitle */
.activation-subtitle {
    font-family: 'RTL', sans-serif;
    font-size: var(--activation-text-sm);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.72);
    margin: 0;
    text-align: center;
    line-height: 1.6;
    max-width: 100%;
}

/* Passcode Inputs Container */
.passcode-inputs-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

/* Individual Passcode Input */
.passcode-input {
    width: 140px;
    height: 140px;
    background: #182024;
    border: 2px solid #3db3b2;
    border-radius: 30px;
    font-family: 'RTL', sans-serif;
    font-size: 48px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

.passcode-input:focus {
    border-color: rgba(207, 216, 255, 0.68);
    box-shadow: 0 0 0 3px rgba(207, 216, 255, 0.08);
    transform: scale(1.05);
}

.passcode-input.error {
    border-color: #ff4444;
    animation: shake 0.5s;
}

/* Submit Button */
.activation-submit-btn {
    font-family: 'RTL', sans-serif;
    font-size: var(--activation-text-md);
    font-weight: 600;
    color: #f6f8ff;
    background: rgba(46, 46, 46, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    min-height: 48px;
    padding: 0.8rem 1.35rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    width: 100%;
    max-width: 100%;
}

.activation-back-btn {
    font-family: 'RTL', sans-serif;
    font-size: var(--activation-text-md);
    font-weight: 600;
    color: #ffffff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    min-height: 48px;
    padding: 0.8rem 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 210px;
}

.activation-back-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.activation-submit-btn:hover:not(:disabled) {
    background: rgba(56, 56, 56, 0.94);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.activation-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.activation-submit-btn:disabled {
    background: rgba(36, 36, 36, 0.94);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Error Message */
.activation-error {
    font-family: 'RTL', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #ff4444;
    text-align: center;
    margin-top: 10px;
    min-height: 20px;
    transition: all 0.3s ease;
}

/* Success Message Animation */
@keyframes successPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.02);
    }
}

.activation-error.success {
    animation: successPulse 2s ease-in-out infinite;
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

.activation-modal-overlay.shake {
    animation: shake 0.5s;
}

/* Input styles */
.activation-input {
    width: 100%;
    padding: 0.9rem 1rem;
    background: rgba(28, 28, 28, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    text-align: right;
    direction: ltr;
    transition: all 0.3s ease;
}

.activation-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.activation-form-block {
    margin: 1.5rem auto;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.activation-form-block.single-field {
    gap: 0;
}

/* نموذج الدخول — تقليل الفراغ بين الحقول وبين كلمة المرور ورابط الاستعادة */
.activation-form-block--login {
    margin-top: clamp(10px, 2.5vw, 18px);
    margin-bottom: clamp(2px, 0.6vw, 6px);
}

/* شاشة استعادة كلمة المرور (الخطوة الأولى): تقليل الفراغ تحت حقل البريد */
#loginModalOverlay #forgotStep1 .activation-form-block {
    margin-bottom: clamp(6px, 1vw, 10px);
}

.activation-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.88rem;
    margin-bottom: 0.5rem;
    text-align: right;
    direction: rtl;
}

.activation-note {
    font-size: var(--activation-text-sm);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin: 1rem auto;
    max-width: 400px;
}

.activation-actions {
    display: flex;
    gap: var(--activation-space-sm);
    justify-content: center;
    align-items: stretch;
    margin-top: 1rem;
    width: 100%;
}

.activation-actions .activation-back-btn,
.activation-actions .activation-submit-btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    width: auto;
    margin-top: 0;
    min-height: 48px;
    height: 48px;
    padding: 0 1rem;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
}

.activation-switch-link {
    margin-top: 1.5rem;
    cursor: pointer;
}

.activation-switch-link span {
    color: #4fc5c4;
    text-decoration: underline;
}

.activation-login-btn {
    width: 100%;
    max-width: 400px;
}

.activation-forgot-row {
    margin-top: var(--activation-space-sm);
    text-align: center;
}

/* تحت حقل كلمة المرور مباشرة — centered، بدون فراغ زائد */
.activation-forgot-under-password {
    width: 100%;
    max-width: 400px;
    margin-top: 0;
    margin-bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* رابط نسيت كلمة المرور في نافذة الدخول */
#loginModalOverlay .activation-forgot-under-password .activation-text-link--compact {
    margin-top: 0;
    margin-bottom: 0;
    padding: 4px 14px;
    min-height: 44px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* مساحة الخطأ فقط عند وجود نص — لا فراغ كبير بين الرابط وزر الدخول */
#loginModalOverlay #loginForm .activation-error:empty {
    display: none;
    margin: 0;
    min-height: 0;
}

#loginModalOverlay #loginForm .activation-error:not(:empty) {
    display: block;
    margin-top: 8px;
    margin-bottom: 0;
    min-height: 0;
}

#loginModalOverlay #loginForm .activation-login-btn {
    margin-top: clamp(10px, 2.5vw, 14px);
}

.login-modal-forgot-stage {
    width: 100%;
    min-height: 0;
    height: auto;
}

/* تقليل الجوانب في شاشة استعادة كلمة المرور */
#loginModalOverlay .activation-modal-container.login-modal--forgot-open {
    width: min(460px, 94vw);
    padding: clamp(10px, 2.2vw, 14px) clamp(10px, 2.2vw, 14px) clamp(14px, 2.6vw, 18px);
}

/* رفع عنوان "استعادة كلمة المرور" قليلاً للأعلى */
#loginModalOverlay .activation-modal-container.login-modal--forgot-open #forgotPasswordPanel > .activation-title {
    margin-top: clamp(-8px, -1.2vw, -4px);
    margin-bottom: clamp(8px, 1.6vw, 14px);
}

/* صف الرجوع: يمين المودال فعلياً (تجاوز تعارض RTL + هوامش div على الشاشات الواسعة) */
.activation-forgot-header {
    width: 100%;
    max-width: none;
    margin-inline: 0;
    margin-bottom: var(--activation-space-md);
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-self: stretch;
    direction: ltr;
}

.activation-forgot-nav-back {
    direction: rtl;
    unicode-bidi: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 var(--activation-space-sm);
    margin-inline-start: 0;
    font-size: var(--activation-text-sm);
    color: rgba(255, 255, 255, 0.75);
    background: none;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

.activation-forgot-nav-back:hover {
    color: #4fc5c4;
}

.activation-otp-input {
    direction: ltr;
    text-align: center;
}

/* صف مربعات رمز التحقق (6 خانات) */
.activation-otp-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: clamp(6px, 2vw, 10px);
    width: 100%;
    max-width: 400px;
    margin: var(--activation-space-sm) auto;
    flex-wrap: nowrap;
}

.activation-otp-digit {
    width: clamp(44px, 11vw, 52px);
    height: clamp(48px, 12vw, 56px);
    min-width: 44px;
    min-height: 48px;
    padding: 0;
    text-align: center;
    font-size: clamp(1.1rem, 4vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    direction: ltr;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .activation-otp-digit {
        width: clamp(48px, 6vw, 54px);
        height: clamp(52px, 7vw, 58px);
    }
}

.activation-forgot-resend-wrap {
    width: 100%;
    max-width: 400px;
    margin-top: clamp(4px, 1vw, 8px);
    display: flex;
    justify-content: center;
}

.activation-text-link--compact {
    margin-top: 0;
    padding: clamp(6px, 1.5vw, 10px) 0;
    min-height: 44px;
}

.activation-text-link {
    display: inline-block;
    margin-top: var(--activation-space-sm);
    color: #4fc5c4;
    font-size: var(--activation-text-sm);
    text-decoration: underline;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    background: none;
    border: none;
    padding: clamp(8px, 2vw, 12px);
    min-height: 44px;
    line-height: 1.4;
}

/* صف زر التالي + شراء تفعيل — خطوة السيريال */
.activation-serial-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: clamp(10px, 2.5vw, 16px);
    width: 100%;
    max-width: 400px;
    margin-inline: auto;
    margin-top: 0.5rem;
    align-items: stretch;
}

.activation-serial-actions .activation-serial-btn,
.activation-serial-actions .activation-buy-serial-btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
    margin-top: 0;
}

.activation-buy-serial-btn {
    font-family: 'RTL', sans-serif;
    font-size: var(--activation-text-md);
    font-weight: 600;
    color: #e8fbfa;
    background: transparent;
    border: 1px solid rgba(79, 197, 196, 0.55);
    border-radius: 12px;
    min-height: 48px;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.activation-buy-serial-btn:hover:not(:disabled) {
    background: rgba(79, 197, 196, 0.12);
    border-color: rgba(79, 197, 196, 0.85);
}

.activation-buy-serial-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.activation-buy-serial-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Input container transition */
.activation-step > div {
    transition: opacity 0.3s ease;
}

/* Center input containers on desktop */
@media (min-width: 768px) {
    .activation-input {
        text-align: center;
    }
    
    .activation-step > div:not(.activation-forgot-header) {
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 1024px) {
    .activation-modal-container {
        width: min(460px, 88vw);
    }
}

@media (min-width: 1440px) {
    .activation-modal-container {
        width: min(480px, 84vw);
    }
}

@media (max-width: 767px) {
    .activation-modal-container {
        padding: var(--activation-space-md);
    }

    .activation-logo img {
        height: clamp(46px, 13vw, 60px);
    }
}

/* —— استعادة كلمة المرور: حقول + شريط القوة (بدون إطار بطاقة) —— */
#loginModalOverlay #forgotStep2Passwords {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(10px, 1.8vw, 14px);
}

#loginModalOverlay #forgotStep2Passwords .activation-form-block--login {
    margin-top: clamp(8px, 1.6vw, 14px);
    margin-bottom: clamp(2px, 1vw, 8px);
    gap: clamp(10px, 1.8vw, 14px);
}

#loginModalOverlay #forgotError2:empty {
    display: none;
    margin: 0;
    min-height: 0;
}

#loginModalOverlay #forgotError2:not(:empty) {
    display: block;
    text-align: center;
    margin-top: 0;
    margin-bottom: 0;
}

#loginModalOverlay #forgotError2Otp:empty {
    display: none;
    margin: 0;
    min-height: 0;
}

#loginModalOverlay #forgotError2Otp:not(:empty) {
    display: block;
    margin-top: clamp(4px, 1vw, 8px);
    margin-bottom: clamp(2px, 0.8vw, 6px);
    min-height: 0;
    text-align: center;
}

#loginModalOverlay #forgotStep2Passwords .activation-login-btn {
    margin-top: clamp(10px, 2vw, 16px);
    margin-bottom: clamp(4px, 1.2vw, 10px);
}

.activation-pw-strength {
    width: 100%;
    margin-top: clamp(4px, 1vw, 8px);
}

.activation-pw-strength__label {
    font-family: 'RTL', sans-serif;
    font-size: clamp(0.8rem, 2vw, 0.88rem);
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: clamp(6px, 1.5vw, 10px);
    text-align: center;
}

.activation-pw-strength__bars {
    display: flex;
    flex-direction: row;
    gap: clamp(6px, 1.5vw, 10px);
    width: 100%;
}

.activation-pw-strength__seg {
    flex: 1 1 0;
    min-width: 0;
    height: clamp(6px, 1.2vw, 8px);
    border-radius: clamp(4px, 1vw, 6px);
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.2s ease, transform 0.2s ease;
}

.activation-pw-strength__seg[data-active='1'] {
    transform: scaleY(1.15);
}

.activation-pw-strength--weak .activation-pw-strength__seg[data-active='1'] {
    background: rgba(220, 100, 100, 0.92);
}

.activation-pw-strength--medium .activation-pw-strength__seg[data-active='1'] {
    background: rgba(220, 175, 90, 0.95);
}

.activation-pw-strength--strong .activation-pw-strength__seg[data-active='1'] {
    background: rgba(79, 197, 196, 0.95);
}

#loginModalOverlay #forgotConfirmBtn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

