@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/**
 * Magfa OTP — Glassmorphism Styles (Reference-Matched)
 *
 * Section 1: Targeted .page-authentication / .page-register overrides
 * Section 2: MagfaOTP component styles
 */

/* ═══════════════════════════════════════════════════════════════════════
   1. Authentication Page — Neutralize PrestaShop Layout
   These selectors are scoped to .page-authentication so they only
   affect the login/register page. Other pages are untouched.
   ═══════════════════════════════════════════════════════════════════════ */

/* Force full-viewport dark background on auth & register pages */
/* Global reset — allow vertical scroll on all pages */
html, body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Scoped to auth/register pages only */
body.page-authentication,
body.page-register {
    width: 100% !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: linear-gradient(135deg, #0f172a, #1e3a8a) !important;
    background-attachment: fixed !important;
    font-family: 'Vazirmatn', 'Vazir', tahoma, sans-serif !important;
}

/* Hide PS chrome, breadcrumb, page title, separator, and containers */
.page-authentication #header,
.page-authentication #footer,
.page-authentication .breadcrumb,
.page-authentication .page-header,
.page-authentication h1.h2,
.page-authentication .container-lg,
.page-authentication hr,
.page-register #header,
.page-register #footer,
.page-register .breadcrumb,
.page-register .page-header,
.page-register h1.h2,
.page-register .container-lg,
.page-register hr,
.page-register #customer-form,
.page-register .register-form {
    display: none !important;
}

/* Hide the DEFAULT PrestaShop email/password login form */
.page-authentication #login-form,
.page-authentication .login-form,
.page-authentication .no-account,
.page-authentication .forgot-password,
.page-authentication .block-centered,
.page-authentication .login-form .form-group,
.page-authentication .login-form [type='submit'],
.page-authentication .js-customer-form {
    display: none !important;
}

/* Strip width & background restrictions from PS wrappers */
body.page-authentication #wrapper,
body.page-authentication #content-wrapper,
body.page-authentication #main,
body.page-authentication #content,
body.page-authentication .container,
body.page-register #wrapper,
body.page-register #content-wrapper,
body.page-register #main,
body.page-register #content,
body.page-register .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}


/* ═══════════════════════════════════════════════════════════════════════
   2. CSS Custom Properties
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-wrapper {
    /* Background */
    --m-otp-bg-1: #0b1120;
    --m-otp-bg-2: #0f1b3d;
    --m-otp-bg-3: #162550;

    /* Card */
    --m-otp-card-bg: rgba(255, 255, 255, 0.07);
    --m-otp-card-border: rgba(255, 255, 255, 0.18);
    --m-otp-card-radius: 20px;

    /* Accent */
    --m-otp-cyan: #38bdf8;
    --m-otp-purple: #8b5cf6;

    /* Text */
    --m-otp-white: #ffffff;
    --m-otp-light: rgba(255, 255, 255, 0.65);
    --m-otp-muted: rgba(255, 255, 255, 0.4);

    /* Danger */
    --m-otp-red: #ef4444;
    --m-otp-red-dark: #dc2626;

    /* Radius */
    --m-otp-r: 14px;
    --m-otp-r-sm: 10px;
}


/* ═══════════════════════════════════════════════════════════════════════
   3. Wrapper — Full-Viewport Dark Background
   Takes control of the authentication area.
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    direction: rtl;
    font-family: 'Vazirmatn', 'Vazir', tahoma, sans-serif;
    box-sizing: border-box;

    /* Dark gradient — matches reference */
    background:
        radial-gradient(ellipse at 30% 0%, rgba(56, 189, 248, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 100%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
        linear-gradient(160deg, var(--m-otp-bg-1) 0%, var(--m-otp-bg-2) 50%, var(--m-otp-bg-3) 100%);
}


/* ═══════════════════════════════════════════════════════════════════════
   4. Glass Card — Matches Reference
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-card {
    width: 100%;
    max-width: 400px;
    min-height: 490px;
    padding: 40px 36px 36px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;

    background: var(--m-otp-card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--m-otp-card-border);
    border-radius: var(--m-otp-card-radius);

    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 60px -15px rgba(99, 102, 241, 0.1);

    animation: mOtpCardIn 0.5s ease-out;
}

@keyframes mOtpCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}


/* ═══════════════════════════════════════════════════════════════════════
   5. Logo
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-logo {
    margin-bottom: 24px;
}


/* ═══════════════════════════════════════════════════════════════════════
   5a. Fade Transition Classes
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-fade-block {
    opacity: 1;
    transition: opacity 0.25s ease-in-out;
}

.magfaotp-fade-block.magfaotp-fade-out {
    opacity: 0;
}

.magfaotp-logo img {
    max-height: 52px;
    max-width: 170px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.magfaotp-logo a {
    display: inline-block;
}


/* ═══════════════════════════════════════════════════════════════════════
   5b. Back Arrow — Top-Right of Card
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-card {
    position: relative;
}

.magfaotp-back-arrow {
    position: absolute;
    top: 18px;
    right: 20px;
    color: var(--m-otp-white);
    font-size: 20px;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    line-height: 1;
}

.magfaotp-back-arrow:hover {
    opacity: 1;
    transform: translateX(3px);
}


/* ═══════════════════════════════════════════════════════════════════════
   5c. Name Fields Row (Registration)
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-name-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.magfaotp-name-row .magfaotp-input {
    flex: 1;
    width: 50%;
    direction: rtl;
    text-align: right;
}


/* ═══════════════════════════════════════════════════════════════════════
   5d. Phone Row — Mobile Input (66%) + Send Button
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-phone-row {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: 6px;
    direction: ltr;
}

.magfaotp-mobile-input {
    flex: 0 0 60%;
    max-width: 60%;
}

.magfaotp-btn-send-row {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    font-size: 14px;
    white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════════════
   5e. Toggle Text Links
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-toggle-text {
    margin-top: 22px;
    text-align: center;
    font-size: 13px;
    color: var(--m-otp-white);
}

.magfaotp-toggle-link {
    color: #10b981;
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
}

.magfaotp-toggle-link:hover {
    color: #34d399;
}


/* ═══════════════════════════════════════════════════════════════════════
   6. Typography — Matches Reference
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-title {
    color: var(--m-otp-white);
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.3;
}

.magfaotp-desc {
    color: var(--m-otp-light);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 30px;
}


/* ═══════════════════════════════════════════════════════════════════════
   7. View Containers
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-view {
    animation: mOtpViewIn 0.3s ease-out;
}

@keyframes mOtpViewIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ═══════════════════════════════════════════════════════════════════════
   8. Phone Input — Glass Style Like Reference OTP Boxes
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-field {
    margin-bottom: 20px;
    text-align: right;
}

.magfaotp-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--m-otp-light);
    margin-bottom: 8px;
}

.magfaotp-input {
    width: 100%;
    padding: 15px 18px;
    font-size: 16px;
    font-family: inherit;
    color: var(--m-otp-white);
    text-align: left;
    direction: ltr;
    box-sizing: border-box;

    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--m-otp-r);
    outline: none;

    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
}

.magfaotp-input::placeholder {
    color: var(--m-otp-muted);
}

.magfaotp-input:focus {
    border-color: var(--m-otp-cyan);
    background: rgba(56, 189, 248, 0.08);
    box-shadow:
        0 0 0 3px rgba(56, 189, 248, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}


/* ═══════════════════════════════════════════════════════════════════════
   9. OTP Digit Boxes — Matches Reference Exactly
   4 boxes, large, glass, rounded, centered
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-inputs {
    display: flex;
    gap: 16px;
    justify-content: center;
    direction: ltr;
    margin-bottom: 30px;
}

.magfaotp-inputs .magfaotp-input {
    width: 64px;
    height: 68px;
    padding: 0;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    direction: ltr;

    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;

    box-shadow:
        inset 0 2px 6px rgba(255, 255, 255, 0.06),
        0 6px 16px rgba(0, 0, 0, 0.2);

    transition: all 0.25s ease;
}

.magfaotp-inputs .magfaotp-input:focus {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--m-otp-cyan);
    transform: scale(1.05);
    box-shadow:
        0 0 0 3px rgba(56, 189, 248, 0.12),
        0 0 20px rgba(56, 189, 248, 0.2),
        0 0 40px rgba(56, 189, 248, 0.08);
}

/* Remove number input spinners */
.magfaotp-inputs .magfaotp-input::-webkit-outer-spin-button,
.magfaotp-inputs .magfaotp-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.magfaotp-inputs .magfaotp-input[type="number"] {
    -moz-appearance: textfield;
}


/* ═══════════════════════════════════════════════════════════════════════
   10. Phone Display (Step 2)
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-phone-display {
    color: var(--m-otp-cyan);
    font-weight: 600;
    direction: ltr;
    display: inline;
}


/* ═══════════════════════════════════════════════════════════════════════
   11. Primary Button (Send OTP — Step 1)
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: var(--m-otp-r);
    transition: all 0.25s ease;
}

.magfaotp-btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.magfaotp-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.45);
    filter: brightness(1.08);
}

.magfaotp-btn-primary:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(0.95);
}

.magfaotp-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* ═══════════════════════════════════════════════════════════════════════
   12. Action Buttons — Resend (Ghost) + Cancel (Solid Red)
   Matches reference: Resend = ghost/outline, Cancel = solid red
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* Base action button */
.magfaotp-actions .magfaotp-btn {
    flex: 1;
    max-width: 180px;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: var(--m-otp-r-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Resend — ghost/outline with purple text (matches reference) */
.magfaotp-btn-ghost {
    background: transparent;
    color: var(--m-otp-purple);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.magfaotp-btn-ghost:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.35);
    transform: translateY(-1px);
}

.magfaotp-btn-ghost:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

/* Cancel — SOLID RED (matches reference exactly) */
.magfaotp-btn-cancel {
    background: var(--m-otp-red);
    color: #ffffff;
    border: none;
}

.magfaotp-btn-cancel:hover {
    background: var(--m-otp-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.magfaotp-btn-cancel:active {
    transform: translateY(0);
}


/* ═══════════════════════════════════════════════════════════════════════
   13. Error & Success Messages
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-message {
    display: none;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: var(--m-otp-r-sm);
    margin-top: 14px;
    text-align: center;
    line-height: 1.5;
    animation: mOtpMsgIn 0.25s ease-out;
}

@keyframes mOtpMsgIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.magfaotp-error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.magfaotp-success {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.2);
}


/* ═══════════════════════════════════════════════════════════════════════
   14. Loading Spinner
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-loading {
    display: none;
    text-align: center;
    font-size: 13px;
    color: var(--m-otp-muted);
    margin-top: 14px;
    padding-bottom: 15px;
}

.magfaotp-loading.show {
    display: block;
}

.magfaotp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--m-otp-cyan);
    border-radius: 50%;
    animation: mOtpSpin 0.7s linear infinite;
    vertical-align: middle;
    margin-left: 6px;
}

@keyframes mOtpSpin {
    to { transform: rotate(360deg); }
}


/* ═══════════════════════════════════════════════════════════════════════
   15. Countdown Timer
   ═══════════════════════════════════════════════════════════════════════ */
.magfaotp-countdown {
    color: var(--m-otp-light);
    font-size: 13px;
    margin-top: 18px;
    transition: color 0.3s;
}

.magfaotp-countdown.disabled {
    color: var(--m-otp-muted);
}


/* ═══════════════════════════════════════════════════════════════════════
   16. Shake Animation
   ═══════════════════════════════════════════════════════════════════════ */
@keyframes mOtpShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}


/* ═══════════════════════════════════════════════════════════════════════
   17. Responsive
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .magfaotp-wrapper {
        padding: 24px 14px;
    }

    .magfaotp-card {
        padding: 32px 24px 28px;
        border-radius: 18px;
    }

    .magfaotp-title {
        font-size: 22px;
    }

    .magfaotp-desc {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .magfaotp-inputs {
        gap: 12px;
    }

    .magfaotp-inputs .magfaotp-input {
        width: 56px;
        height: 60px;
        font-size: 24px;
        border-radius: 12px;
    }

    .magfaotp-actions .magfaotp-btn {
        padding: 11px 16px;
        font-size: 13px;
    }
}

@media (max-width: 375px) {
    .magfaotp-card {
        padding: 28px 18px 24px;
    }

    .magfaotp-inputs {
        gap: 8px;
    }

    .magfaotp-inputs .magfaotp-input {
        width: 50px;
        height: 54px;
        font-size: 22px;
    }

    .magfaotp-actions {
        flex-direction: column;
        gap: 8px;
    }

    .magfaotp-actions .magfaotp-btn {
        max-width: 100%;
    }
}


/* ═══════════════════════════════════════════════════════════════════════
   18. Reduced Motion
   ═══════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .magfaotp-card,
    .magfaotp-view,
    .magfaotp-message {
        animation: none;
    }

    .magfaotp-input,
    .magfaotp-btn,
    .magfaotp-btn-ghost,
    .magfaotp-btn-cancel,
    .magfaotp-inputs .magfaotp-input {
        transition: none;
    }

    .magfaotp-inputs .magfaotp-input:focus {
        transform: none;
    }

    .magfaotp-btn-primary:hover:not(:disabled),
    .magfaotp-btn-ghost:hover:not(:disabled),
    .magfaotp-btn-cancel:hover {
        transform: none;
    }
}


/* ═══════════════════════════════════════════════════════════════════════
   19. Print
   ═══════════════════════════════════════════════════════════════════════ */
@media print {
    .magfaotp-wrapper {
        display: none !important;
    }
}

#backStepBtn {
    background: none;
    border: none;
}