/* =============================================================================
   MSV Auth Modal — Premium Login / Register / Forgot Password
   ============================================================================= */

/* ── Modal overlay ─────────────────────────────────────────────────────────── */
.msv-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    visibility: hidden;
    pointer-events: none;
}
.msv-auth-modal.is-open {
    visibility: visible;
    pointer-events: auto;
}

.msv-auth-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 20, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.28s ease;
    cursor: pointer;
}
.msv-auth-modal.is-open .msv-auth-modal__overlay {
    opacity: 1;
}

/* ── Dialog card ───────────────────────────────────────────────────────────── */
.msv-auth-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transform: translateY(24px) scale(0.97);
    opacity: 0;
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.28s ease;
    will-change: transform, opacity;
}
.msv-auth-modal.is-open .msv-auth-modal__dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ── Header strip ──────────────────────────────────────────────────────────── */
.msv-auth-modal__header {
    background: linear-gradient(135deg, var(--primary-color, #7c3aed) 0%, color-mix(in srgb, var(--primary-color, #7c3aed) 70%, #000) 100%);
    padding: 28px 32px 24px;
    position: relative;
}
.msv-auth-modal__header-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 2px;
    line-height: 1.2;
}
.msv-auth-modal__header-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    margin: 0;
}

/* ── Close button ──────────────────────────────────────────────────────────── */
.msv-auth-modal__close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.15s;
    padding: 0;
    line-height: 1;
}
.msv-auth-modal__close:hover { background: rgba(255,255,255,0.32); }
.msv-auth-modal__close svg { width: 16px; height: 16px; stroke: #fff; }

/* ── Tab bar ───────────────────────────────────────────────────────────────── */
.msv-auth-tabs {
    display: flex;
    background: #f4f4f8;
    padding: 5px;
    margin: 20px 24px 0;
    border-radius: 12px;
    position: relative;
    gap: 2px;
}
.msv-auth-tabs__item {
    flex: 1;
    border: none;
    background: none;
    padding: 9px 12px;
    font-size: 13.5px;
    font-weight: 600;
    color: #6b7280;
    border-radius: 9px;
    cursor: pointer;
    transition: color 0.18s;
    position: relative;
    z-index: 1;
    font-family: inherit;
}
.msv-auth-tabs__item.is-active {
    color: #1f2937;
}
.msv-auth-tabs__ink {
    position: absolute;
    top: 5px;
    bottom: 5px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    transition: left 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* ── Panels ────────────────────────────────────────────────────────────────── */
.msv-auth-panels {
    overflow: hidden;
    position: relative;
}
.msv-auth-panels__track {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}
.msv-auth-panel {
    min-width: 100%;
    padding: 20px 24px 28px;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Forgot panel — not in the track (slides in from right) */
.msv-auth-panel--forgot {
    padding-top: 8px;
}

/* ── Back button ───────────────────────────────────────────────────────────── */
.msv-auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color, #7c3aed);
    cursor: pointer;
    padding: 0 0 14px;
    font-family: inherit;
    transition: opacity 0.15s;
}
.msv-auth-back:hover { opacity: 0.75; }
.msv-auth-back svg { width: 14px; height: 14px; }

/* Forgot panel icon/intro */
.msv-auth-panel__intro {
    text-align: center;
    padding: 8px 0 20px;
}
.msv-auth-panel__intro-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--primary-color, #7c3aed) 10%, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.msv-auth-panel__intro-icon svg { width: 26px; height: 26px; color: var(--primary-color, #7c3aed); }
.msv-auth-panel__intro h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 5px;
}
.msv-auth-panel__intro p {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ── Field ─────────────────────────────────────────────────────────────────── */
.msv-field {
    position: relative;
    margin-bottom: 14px;
}
.msv-field__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color 0.18s;
}
.msv-field__icon svg { width: 16px; height: 16px; }
.msv-field input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1.5px solid #e5e7eb;
    border-radius: 11px;
    font-size: 14px;
    font-family: inherit;
    color: #1f2937;
    background: #fafafa;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    box-sizing: border-box;
    outline: none;
    -webkit-appearance: none;
}
.msv-field input::placeholder { color: #9ca3af; }
.msv-field input:focus {
    border-color: var(--primary-color, #7c3aed);
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color, #7c3aed) 15%, transparent);
}
.msv-field input.is-error { border-color: #ef4444; }
.msv-field input.is-error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
.msv-field input.is-valid { border-color: #10b981; }
.msv-field:focus-within .msv-field__icon { color: var(--primary-color, #7c3aed); }

/* Password toggle eye */
.msv-field--pw { }
.msv-field__toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
    line-height: 1;
}
.msv-field__toggle-pw:hover { color: #4b5563; }
.msv-field__toggle-pw svg { width: 17px; height: 17px; }
.msv-field--pw input { padding-right: 44px; }

/* Password strength meter */
.msv-pw-strength {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -8px 0 14px;
    min-height: 20px;
}
.msv-pw-strength__bars {
    display: flex;
    gap: 4px;
    flex: 1;
}
.msv-pw-strength__bar {
    height: 4px;
    flex: 1;
    border-radius: 99px;
    background: #e5e7eb;
    transition: background 0.25s ease;
}
.msv-pw-strength__bar.is-filled.strength-1 { background: #ef4444; }
.msv-pw-strength__bar.is-filled.strength-2 { background: #f59e0b; }
.msv-pw-strength__bar.is-filled.strength-3 { background: #10b981; }
.msv-pw-strength__bar.is-filled.strength-4 { background: #059669; }
.msv-pw-strength__label {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    color: #6b7280;
    min-width: 46px;
    text-align: right;
    transition: color 0.25s;
}

/* Password match icon */
.msv-field__match {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}
.msv-field__match svg { width: 16px; height: 16px; display: none; }
.msv-field__match .msv-match-ok { color: #10b981; }
.msv-field__match .msv-match-no { color: #ef4444; }
.msv-field__match.show-ok .msv-match-ok { display: block; }
.msv-field__match.show-no .msv-match-no { display: block; }

/* ── Options row (remember me + forgot) ────────────────────────────────────── */
.msv-auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 8px;
}
.msv-auth-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    user-select: none;
}
.msv-auth-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary-color, #7c3aed);
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}
.msv-forgot-trigger {
    font-size: 13px;
    color: var(--primary-color, #7c3aed);
    text-decoration: none;
    font-weight: 500;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.msv-forgot-trigger:hover { opacity: 0.75; text-decoration: none; }

/* ── Submit button ─────────────────────────────────────────────────────────── */
.msv-auth-btn {
    width: 100%;
    padding: 13px 20px;
    background: var(--primary-color, #7c3aed);
    color: var(--primary-text-color, #fff);
    border: none;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.18s, transform 0.12s, box-shadow 0.18s;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary-color, #7c3aed) 40%, transparent);
    position: relative;
    overflow: hidden;
    margin-top: 2px;
}
.msv-auth-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--primary-color, #7c3aed) 45%, transparent);
}
.msv-auth-btn:active:not(:disabled) {
    transform: translateY(0);
}
.msv-auth-btn:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    transform: none;
}
.msv-auth-btn__text { transition: opacity 0.15s; }
.msv-auth-btn.is-loading .msv-auth-btn__text { opacity: 0; }

/* Spinner inside button */
.msv-auth-btn__spinner {
    position: absolute;
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.15s;
    animation: msv-spin 0.75s linear infinite;
}
.msv-auth-btn.is-loading .msv-auth-btn__spinner { opacity: 1; }

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

/* ── Message ───────────────────────────────────────────────────────────────── */
.msv-auth-msg {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.45;
    display: none;
    align-items: center;
    gap: 8px;
    animation: msv-msg-in 0.2s ease;
}
.msv-auth-msg.is-visible { display: flex; }
.msv-auth-msg svg { width: 16px; height: 16px; flex-shrink: 0; }
.msv-auth-msg.is-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.msv-auth-msg.is-error svg { color: #ef4444; }
.msv-auth-msg.is-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.msv-auth-msg.is-success svg { color: #10b981; }

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

/* ── Social login divider ──────────────────────────────────────────────────── */
.msv-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 14px;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 500;
}
.msv-auth-divider::before,
.msv-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ── Footer (sign-up link) ─────────────────────────────────────────────────── */
.msv-auth-footer {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    margin-top: 16px;
}
.msv-auth-footer a {
    color: var(--primary-color, #7c3aed);
    font-weight: 600;
    text-decoration: none;
}
.msv-auth-footer a:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .msv-auth-modal { padding: 0; align-items: flex-end; }
    .msv-auth-modal__dialog {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(60px) scale(1);
    }
    .msv-auth-modal.is-open .msv-auth-modal__dialog { transform: translateY(0) scale(1); }
    .msv-auth-modal__header { padding: 22px 20px 18px; }
    .msv-auth-panel { padding: 16px 20px 24px; }
    .msv-auth-tabs { margin: 16px 20px 0; }
}

/* ── Legacy .message compatibility (shortcode forms) ──────────────────────── */
.message {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    display: none;
}
.message.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.message.error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
