/* =====================================================
   Mobile Login OTP - Frontend Styles
   Fully responsive + soft animations
   ===================================================== */

.mlo-wrapper {
    --mlo-radius: 16px;
    --mlo-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    direction: rtl;
    max-width: 420px;
    margin: 40px auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.mlo-wrapper *,
.mlo-wrapper *::before,
.mlo-wrapper *::after {
    box-sizing: border-box;
}

/* ---------- Themes ---------- */
.mlo-theme-light {
    --mlo-bg: #ffffff;
    --mlo-card-bg: #ffffff;
    --mlo-text: #1a1a2e;
    --mlo-text-muted: #6b7280;
    --mlo-border: #e5e7eb;
    --mlo-input-bg: #f9fafb;
    --mlo-primary: #4f46e5;
    --mlo-primary-hover: #4338ca;
    --mlo-primary-text: #ffffff;
    --mlo-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --mlo-error: #ef4444;
    --mlo-success: #10b981;
}

.mlo-theme-dark {
    --mlo-bg: #0f172a;
    --mlo-card-bg: #1e293b;
    --mlo-text: #f1f5f9;
    --mlo-text-muted: #94a3b8;
    --mlo-border: #334155;
    --mlo-input-bg: #0f172a;
    --mlo-primary: #818cf8;
    --mlo-primary-hover: #6366f1;
    --mlo-primary-text: #0f172a;
    --mlo-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    --mlo-error: #f87171;
    --mlo-success: #34d399;
}

/* ---------- Card ---------- */
.mlo-card {
    background: var(--mlo-card-bg);
    border-radius: var(--mlo-radius);
    box-shadow: var(--mlo-shadow);
    padding: 36px 28px;
    border: 1px solid var(--mlo-border);
    position: relative;
    overflow: hidden;
}

/* ---------- Logo ---------- */
.mlo-logo {
    text-align: center;
    margin-bottom: 24px;
}

.mlo-logo img {
    max-height: 64px;
    max-width: 180px;
    object-fit: contain;
}

/* ---------- Titles ---------- */
.mlo-title {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mlo-text);
    text-align: center;
}

.mlo-subtitle {
    margin: 0 0 28px;
    font-size: 0.95rem;
    color: var(--mlo-text-muted);
    text-align: center;
}

/* ---------- Steps (animation) ---------- */
.mlo-step {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    position: absolute;
    width: calc(100% - 56px);
    left: 28px;
    right: 28px;
    transition: opacity var(--mlo-transition), transform var(--mlo-transition);
}

.mlo-step.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
    width: 100%;
    left: auto;
    right: auto;
}

/* Keep height stable while switching */
.mlo-card {
    min-height: 280px;
}

/* ---------- Fields ---------- */
.mlo-field {
    margin-bottom: 20px;
}

.mlo-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mlo-text);
}

.mlo-input-wrap {
    display: flex;
    align-items: center;
    background: var(--mlo-input-bg);
    border: 1.5px solid var(--mlo-border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color var(--mlo-transition), box-shadow var(--mlo-transition);
}

.mlo-input-wrap:focus-within {
    border-color: var(--mlo-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.mlo-prefix {
    padding: 0 14px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--mlo-text-muted);
    background: transparent;
    border-left: 1px solid var(--mlo-border);
    white-space: nowrap;
    direction: ltr;
}

.mlo-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 16px;
    font-size: 1.05rem;
    color: var(--mlo-text);
    outline: none;
    width: 100%;
    direction: ltr;
    text-align: left;
    letter-spacing: 0.5px;
}

.mlo-input::placeholder {
    color: var(--mlo-text-muted);
    opacity: 0.7;
}

.mlo-input-otp {
    text-align: center;
    font-size: 1.4rem;
    letter-spacing: 8px;
    font-weight: 600;
    padding: 16px;
    background: var(--mlo-input-bg);
    border: 1.5px solid var(--mlo-border);
    border-radius: 12px;
    transition: border-color var(--mlo-transition), box-shadow var(--mlo-transition);
}

.mlo-input-otp:focus {
    border-color: var(--mlo-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    outline: none;
}

/* ---------- Buttons ---------- */
.mlo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--mlo-transition), transform 0.15s ease, box-shadow var(--mlo-transition);
    position: relative;
}

.mlo-btn-primary {
    background: var(--mlo-primary);
    color: var(--mlo-primary-text);
}

.mlo-btn-primary:hover:not(:disabled) {
    background: var(--mlo-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.mlo-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.mlo-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Spinner */
.mlo-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: mlo-spin 0.7s linear infinite;
}

.mlo-theme-dark .mlo-spinner {
    border-color: rgba(15, 23, 42, 0.3);
    border-top-color: currentColor;
}

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

/* ---------- OTP Meta (timer + links) ---------- */
.mlo-otp-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.875rem;
}

.mlo-timer {
    color: var(--mlo-text-muted);
    font-variant-numeric: tabular-nums;
}

.mlo-link {
    background: none;
    border: none;
    color: var(--mlo-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: opacity var(--mlo-transition);
}

.mlo-link:hover:not(:disabled) {
    text-decoration: underline;
}

.mlo-link:disabled {
    color: var(--mlo-text-muted);
    cursor: default;
    opacity: 0.7;
}

.mlo-edit-number {
    margin-right: auto;
}

/* ---------- Message ---------- */
.mlo-message {
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    text-align: center;
    animation: mlo-fade-in 0.3s ease;
}

.mlo-message.error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--mlo-error);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.mlo-message.success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--mlo-success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

@keyframes mlo-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .mlo-wrapper {
        margin: 20px auto;
        padding: 0 12px;
    }

    .mlo-card {
        padding: 28px 20px;
        border-radius: 14px;
    }

    .mlo-title {
        font-size: 1.3rem;
    }

    .mlo-input-otp {
        font-size: 1.25rem;
        letter-spacing: 6px;
    }

    .mlo-otp-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .mlo-edit-number {
        margin-right: 0;
    }
}
