/* Afaq QuickAuth — login / register UI */
.quickauth-wrapper {
    max-width: 420px;
    margin: 24px auto;
    font-family: "IBM Plex Sans Arabic", sans-serif;
}

.quickauth-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(16, 138, 155, 0.08);
    padding: 28px 24px 22px;
    position: relative;
}

.qa-loading {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 6;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 20px;
    pointer-events: all;
}

.quickauth-wrapper.is-loading .qa-loading {
    display: flex;
}

.qa-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2ecef;
    border-top-color: #108a9b;
    border-radius: 50%;
    animation: qa-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.qa-loading-text {
    font-size: 14px;
    color: #1a2b33;
}

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

.quickauth-header {
    text-align: center;
    margin-bottom: 22px;
}

.quickauth-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: #1a2b33;
    line-height: 1.35;
}

.quickauth-subtitle {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: #6b7c85;
    font-weight: 400;
}

/* Main tabs: دخول / حساب جديد */
.quickauth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    padding: 3px;
    border: 0;
    border-radius: 10px;
    background: #ececec;
}

.quickauth-tabs .qa-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 9px;
    padding: 10px 12px;
    font-size: 15px;
    font-weight: 400;
    color: #6b7c85;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}

.quickauth-tabs .qa-tab.active {
    background: #fff;
    color: #108a9b;
    box-shadow: 0 2px 8px rgba(16, 138, 155, 0.18);
}

/* Method switch: جوال / البريد */
.qa-method-switch {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    padding: 4px;
    border: 1px solid #e0e6e7;
    border-radius: 999px;
}

.qa-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    background: transparent;
    padding: 9px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: #b3b3b3;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #fff;
}

.qa-method-icon::before {
    font-size: 18px;
    line-height: 1;
}

.qa-method.active {
    background: #108a9b;
    color: #fff;
    box-shadow: 0 1px 6px rgba(16, 138, 155, 0.12);
    border: 1px solid #3bc0d2;
}

.qa-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #3d4f57;
    margin: 0 0 8px;
}

.qa-step-hint {
    margin: 0 0 14px;
    font-size: 14px;
    color: #6b7c85;
    text-align: center;
    line-height: 1.5;
}

.qa-resend-timer {
    margin: 14px 0 0;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    color: #6b7c85;
}

.qa-resend-link[hidden],
.qa-resend-timer[hidden] {
    display: none !important;
}

.qa-verified-phone {
    margin: 0 0 16px;
    padding: 10px 12px;
    font-size: 13px;
    color: #108a9b;
    text-align: center;
    background: #f0f9fa;
    border-radius: 8px;
}

.qa-verified-phone span {
    font-weight: 600;
    unicode-bidi: isolate;
}

/* Override theme input[type=…] sizing so QuickAuth fields stay compact. */
.quickauth-wrapper input.qa-input,
.quickauth-wrapper input[type="tel"],
.quickauth-wrapper input[type="email"],
.quickauth-wrapper input[type="password"],
.quickauth-wrapper input[type="text"] {
    font-size: 14px !important;
    height: auto;
    line-height: 1.4;
}

.quickauth-wrapper input.qa-otp-box {
    width: 48px;
    height: 56px;
    font-size: 22px !important;
    line-height: 1.2;
}

.qa-input {
    width: 100%;
    box-sizing: border-box;
    background: #f3f6f7;
    border: 1.5px solid transparent;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    color: #1a2b33;
    transition: border-color 0.2s ease, background 0.2s ease;
    height: auto;
    line-height: 1.4;
}

.qa-input::placeholder {
    color: #a8b5bc;
}

.qa-input:focus {
    border-color: #108a9b;
    background: #fff;
    outline: none;
}

.qa-phone-row {
    display: flex;
    gap: 10px;
    direction: ltr;
    align-items: stretch;
}

.qa-phone-prefix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef4f5;
    border: 1.5px solid #e2ecef;
    border-radius: 12px;
    padding: 0;
    font-size: 16px;
    font-weight: 500;
    color: #1a2b33;
    white-space: nowrap;
    min-width: 65px;
}

.qa-phone {
    flex: 1;
    min-width: 0;
}

.qa-btn {
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 15px 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 18px;
    transition: all 0.3s ease;
}

.qa-btn-primary {
    background: #108a9b;
    color: #fff;
    text-align: center;
    font-weight: 400;
}

.qa-btn-primary:hover:not(:disabled) {
    background: #27abbe;
    border: none;
    color: #fff;
}

.qa-btn-primary:active:not(:disabled) {
    transform: scale(0.99);
}

.qa-btn-primary:disabled {
    background: #c5d0d4;
    color: #fff;
    cursor: not-allowed;
    opacity: 1;
}

.qa-btn--loading {
    color: transparent !important;
    position: relative;
    pointer-events: none;
}

.qa-btn--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: qa-spin 0.7s linear infinite;
}

.quickauth-wrapper.is-loading .qa-btn:not(.qa-btn--loading),
.quickauth-wrapper.is-loading .qa-link,
.quickauth-wrapper.is-loading .qa-method,
.quickauth-wrapper.is-loading .qa-input,
.quickauth-wrapper.is-loading .qa-otp-box,
.quickauth-wrapper.is-loading .qa-social-btn {
    pointer-events: none;
}

.quickauth-wrapper.is-loading .qa-input,
.quickauth-wrapper.is-loading .qa-otp-box {
    opacity: 0.65;
}

.qa-link {
    display: inline-block;
    background: none;
    border: none;
    color: #108a9b;
    font-size: 14px;
    margin-top: 12px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

.qa-link:hover {
    text-decoration: underline;
}

.qa-link-block {
    display: block;
    margin-top: 8px;
}

.qa-otp {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 4px 0 8px;
}

.qa-otp-box {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    border: 1.5px solid #d8e8ec;
    border-radius: 12px;
    background: #f8fbfc;
    color: #1a2b33;
}

.qa-otp-box:focus {
    border-color: #108a9b;
    background: #fff;
    outline: none;
}

.qa-or {
    text-align: center;
    border-top: 1px solid #e8eef0;
    margin: 24px 0 18px;
}

.qa-or span {
    position: relative;
    top: -11px;
    background: #fff;
    padding: 0 14px;
    color: #8a9aa3;
    font-size: 13px;
}

.qa-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    background: #f6f8f9;
    border: 1.5px solid #e8eef0;
    border-radius: 999px;
    padding: 13px 18px;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #1a2b33;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.qa-social-btn:hover {
    background: #eef4f5;
    border-color: #d8e8ec;
    text-decoration: none;
    color: #1a2b33;
}

.qa-social-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.qa-social-ic svg {
    display: block;
}

.quickauth-message {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.quickauth-message.qa-error {
    background: #fdecea;
    color: #b3261e;
}

.quickauth-message.qa-success {
    background: #e8f6f8;
    color: #0e6b7a;
}

.quickauth-legal {
    margin: 22px 0 0;
    padding-top: 16px;
    border-top: 1px solid #eef2f4;
    text-align: center;
    font-size: 12px;
    line-height: 1.7;
    color: #8a9aa3;
}

.quickauth-legal a {
    color: #108a9b;
    font-weight: 600;
    text-decoration: none;
}

.quickauth-legal a:hover {
    text-decoration: underline;
}

.quickauth-change-phone {
    max-width: 560px;
    margin: 0;
}

.quickauth-change-phone .qa-change-phone-card {
    position: relative;
    padding: 22px 22px 24px;
    background: #fff;
    border: 1px solid #eef1f4;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 42, 63, 0.04);
}

.quickauth-change-phone .qa-change-phone-intro {
    margin: 0 0 16px;
}

.quickauth-change-phone .qa-change-phone-lead {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.55;
    color: #4b5563;
}

.quickauth-change-phone .qa-current-mobile {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 0 0 18px;
    padding: 12px 14px;
    background: #f0f9fa;
    border: 1px solid #cdeef5;
    border-radius: 12px;
}

.quickauth-change-phone .qa-current-mobile[hidden],
.quickauth-change-phone .qa-current-mobile.is-empty {
    display: none !important;
}

.quickauth-change-phone .qa-current-mobile__label {
    font-size: 1.25rem;
    color: #6b7280;
}

.quickauth-change-phone .qa-current-mobile__value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e3a5f;
}

.quickauth-change-phone .qa-current-mobile__badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #d1fae5;
    color: #047857;
    font-size: 1.15rem;
    font-weight: 600;
}

.quickauth-change-phone .qa-region-panel {
    display: none;
}

.quickauth-change-phone .qa-region-panel.is-active {
    display: block;
}

.quickauth-change-phone .qa-region-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 0 16px;
    padding: 4px;
    background: #f3f4f6;
    border-radius: 12px;
    position: relative;
    z-index: 2;
}

.quickauth-change-phone .qa-region-switch__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #4b5563;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.quickauth-change-phone .qa-region-switch__hint {
    font-size: 1.15rem;
    font-weight: 500;
    color: #9ca3af;
}

.quickauth-change-phone .qa-region-switch__btn.is-active {
    background: #fff;
    color: #008da9;
    box-shadow: 0 1px 3px rgba(15, 42, 63, 0.1);
}

.quickauth-change-phone .qa-region-switch__btn.is-active .qa-region-switch__hint {
    color: #008da9;
}

.quickauth-change-phone .qa-region-note {
    margin: 0 0 14px;
    font-size: 1.25rem;
    line-height: 1.5;
    color: #6b7280;
}

.quickauth-change-phone .qa-label {
    display: block;
    margin: 0 0 8px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e3a5f;
}

.quickauth-change-phone .qa-phone-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 0 0 16px;
    border: 1.5px solid #e2e6e8;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.quickauth-change-phone .qa-phone-row:focus-within {
    border-color: #008da9;
    box-shadow: 0 0 0 3px rgba(0, 141, 169, 0.12);
}

.quickauth-change-phone .qa-phone-prefix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 0 12px;
    background: #f9fafb;
    border-inline-end: 1px solid #eef1f4;
    color: #4b5563;
    font-size: 1.35rem;
    font-weight: 600;
}

.quickauth-change-phone .qa-phone-prefix--plus {
    min-width: 40px;
    padding: 0 8px;
}

.quickauth-change-phone .qa-phone-row .qa-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 48px;
    margin: 0;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent;
}

.quickauth-change-phone .qa-phone-row .qa-dial {
    flex: 0 0 72px;
    width: 72px;
    text-align: center;
    border-inline-end: 1px solid #eef1f4 !important;
    font-weight: 600;
}

.quickauth-change-phone .qa-btn-primary {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    font-size: 1.4rem;
    font-weight: 600;
}

.quickauth-change-phone .qa-step-hint {
    margin: 0 0 14px;
    font-size: 1.3rem;
    color: #4b5563;
}

.quickauth-change-phone .qa-link {
    display: inline-flex;
    margin-top: 12px;
    margin-inline-end: 14px;
}

@media (max-width: 640px) {
    .quickauth-change-phone .qa-change-phone-card {
        padding: 18px 16px 20px;
        border-radius: 14px;
    }

    .quickauth-change-phone .qa-region-switch__btn {
        font-size: 1.2rem;
        min-height: 48px;
    }
}

/* First-checkout profile email (phone-only accounts) */
.afaq-quickauth-profile-email {
    margin: 0 0 18px;
    padding: 14px 16px;
    background: #f0f9fa;
    border: 1px solid #cdeef5;
    border-radius: 12px;
}

.afaq-quickauth-profile-email .label {
    display: block;
    margin: 0 0 8px;
    font-weight: 600;
    color: #1a2b33;
}

.afaq-quickauth-profile-email .label > span.required {
    color: #e02b27;
    font-weight: 700;
    margin-inline-start: 4px;
}

.afaq-quickauth-profile-email .note {
    margin-top: 8px;
    font-size: 13px;
    color: #6b7c85;
    line-height: 1.5;
}

.modal-popup.quickauth-modal._show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-popup.quickauth-modal .modal-inner-wrap {
    max-width: 460px;
    width: 95%;
    margin: auto;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
}

/* Keep popup-from-top behavior on mobile (do not become side slide) */
.modal-popup.quickauth-modal.modal-slide,
.modal-popup.quickauth-modal {
    left: 0;
    right: 0;
}

.modal-popup.quickauth-modal .modal-inner-wrap {
    position: relative;
    height: auto;
    min-height: 0;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

@media (max-width: 768px) {
    .modal-popup.quickauth-modal._show {
        align-items: flex-start;
        padding: 24px 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-popup.quickauth-modal .modal-inner-wrap {
        width: calc(100% - 32px);
        margin: 0 auto;
        border-radius: 18px;
        max-height: none;
    }
}

.quickauth-modal .quickauth-wrapper {
    margin: 0;
    max-width: 100%;
}

.quickauth-modal .quickauth-card {
    box-shadow: none;
    padding: 8px 4px 4px;
}

.modal-popup.quickauth-modal .modal-header {
    padding-bottom: 0;
    min-height: 0;
    border-bottom: none;
}

.modal-popup.quickauth-modal .modal-title {
    display: none;
}

@media (max-width: 480px) {
    .quickauth-wrapper {
        margin: 12px auto;
    }

    .quickauth-card {
        padding: 22px 18px 18px;
        border-radius: 16px;
    }

    .quickauth-title {
        font-size: 20px;
    }
}
