/* ═══════════════════════════════════════════
   Mobile OTP Login v2 — Styles
   ═══════════════════════════════════════════ */

/* ── Modal Overlay ────────────────────────── */
.mol-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: molFadeIn 0.2s ease;
}

@keyframes molFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

.mol-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    margin: 16px;
    padding: 32px 28px 28px;
    position: relative;
    box-shadow: 0 24px 48px rgba(0,0,0,0.18);
    animation: molSlideUp 0.3s ease;
}

.mol-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.mol-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* ── Tabs ─────────────────────────────────── */
.mol-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #eee;
}

.mol-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.mol-tab:hover {
    color: #555;
}

.mol-tab.mol-tab-active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

/* ── Typography ───────────────────────────── */
.mol-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px;
}

.mol-subtitle {
    font-size: 14px;
    color: #777;
    margin: 0 0 20px;
}

/* ── Phone Input Group ────────────────────── */
.mol-phone-input-group {
    display: flex;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
    margin-bottom: 16px;
}

.mol-phone-input-group:focus-within {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.mol-country-code {
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    background: #f8f8f8;
    border-right: 2px solid #ddd;
    white-space: nowrap;
    user-select: none;
}

.mol-phone-field {
    flex: 1;
    border: none !important;
    padding: 12px 14px;
    font-size: 16px;
    outline: none;
    background: transparent;
    box-shadow: none !important;
    margin: 0 !important;
    width: auto !important;
    min-width: 0;
}

.mol-phone-field::placeholder {
    color: #bbb;
}

/* ── General Inputs ───────────────────────── */
.mol-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.mol-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* ── OTP Boxes ────────────────────────────── */
.mol-otp-boxes {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.mol-otp-digit {
    width: 46px;
    height: 54px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    caret-color: #0073aa;
}

.mol-otp-digit:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.mol-otp-digit.mol-filled {
    border-color: #0073aa;
    background: #f0f7fc;
}

/* ── Buttons ──────────────────────────────── */
.mol-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.mol-btn:active {
    transform: scale(0.98);
}

.mol-btn-primary {
    background: #0073aa;
    color: #fff;
}

.mol-btn-primary:hover {
    background: #005f8d;
}

.mol-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.mol-btn-primary.mol-loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

.mol-btn-primary.mol-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: molSpin 0.6s linear infinite;
}

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

/* ── Link Buttons ─────────────────────────── */
.mol-link-btn {
    background: none;
    border: none;
    color: #0073aa;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 0;
    display: inline-block;
}

.mol-link-btn:hover {
    text-decoration: underline;
}

/* ── OTP Footer ───────────────────────────── */
.mol-otp-footer {
    text-align: center;
    margin: 12px 0 8px;
    font-size: 13px;
    color: #888;
}

.mol-timer {
    font-variant-numeric: tabular-nums;
}

/* ── Messages ─────────────────────────────── */
.mol-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.mol-message.mol-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fee2e2;
}

.mol-message.mol-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #dcfce7;
}

/* ── Demo Hint ────────────────────────────── */
.mol-demo-hint {
    text-align: center;
    font-size: 12px;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 6px 12px;
    margin-top: 12px;
}

/* ── Inline Form (shortcode) ──────────────── */
.mol-inline-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 28px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ── Step transitions ─────────────────────── */
.mol-step {
    animation: molFadeIn 0.25s ease;
}

/* ── Logged in state ──────────────────────── */
.mol-logged-in {
    text-align: center;
    padding: 20px;
    color: #555;
}

.mol-logged-in a {
    color: #0073aa;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 480px) {
    .mol-modal {
        padding: 24px 20px 20px;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        margin: 0;
        max-height: 90vh;
        overflow-y: auto;
        animation: molSlideFromBottom 0.3s ease;
    }

    @keyframes molSlideFromBottom {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .mol-otp-digit {
        width: 40px;
        height: 48px;
        font-size: 20px;
    }
}

/* ── Injected Forms (inside theme containers) ── */
.mol-injected {
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.mol-injected .mol-tabs {
    margin-bottom: 20px;
}

.mol-injected .mol-phone-input-group,
.mol-injected .mol-input,
.mol-injected .mol-btn,
.mol-injected .mol-otp-digit {
    /* Reset any theme styles that might leak in */
    box-sizing: border-box;
    font-family: inherit;
}
