/* ═══════════════════════════════════════
   SARA — LOGIN MODAL (SPEC-LAND-LOGIN-01)
   Tokens: welcome.css (--sara, --font-h, etc.)
   ═══════════════════════════════════════ */

/* ── Overlay ──────────────────────────── */
.lm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.55);
    /* Por encima de widgets flotantes de terceros: WhatsApp FAB (2000000002),
       reCAPTCHA badge (2000000001) y el badge inyectado de Google Translate.
       El modal de login debe cubrirlos siempre. */
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: lmFadeIn 0.18s ease;
}

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

/* ── Card ─────────────────────────────── */
.lm-card {
    background: var(--sara-white);
    border-radius: 18px;
    border: 1px solid var(--sara-border);
    box-shadow: 0 16px 48px rgba(10, 37, 64, 0.16);
    width: 100%;
    max-width: 420px;
    padding: 32px 32px 28px;
    position: relative;
    animation: lmSlideUp 0.22s var(--ease);
}

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

/* ── Cerrar ───────────────────────────── */
.lm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    padding: 6px;
    color: var(--sara-gray-lt);
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lm-close:hover {
    background: var(--sara-bg);
    color: var(--sara-deepest);
}

/* ── Logo ─────────────────────────────── */
.lm-logo {
    margin-bottom: 20px;
}

.lm-logo img {
    height: 26px;
    width: auto;
}

/* ── Alert strip ──────────────────────── */
.lm-alert {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 16px;
    color: var(--sara-deepest);
}

.lm-alert strong {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.lm-alert--success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.lm-alert--warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.lm-alert--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.lm-alert--info {
    background: rgba(0, 154, 219, 0.08);
    border: 1px solid rgba(0, 154, 219, 0.25);
    color: var(--sara-dark);
}

/* ── Tabs nav ─────────────────────────── */
.lm-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--sara-border);
    margin-bottom: 22px;
}

.lm-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 12px 10px;
    font-family: var(--font-b);
    font-size: 13px;
    font-weight: 600;
    color: var(--sara-gray);
    position: relative;
    transition: color 0.2s;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

.lm-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--sara);
    transform: scaleX(0);
    transition: transform 0.2s var(--ease);
    border-radius: 2px 2px 0 0;
}

.lm-tab:hover {
    color: var(--sara);
}

.lm-tab.lm-tab--active {
    color: var(--sara);
}

.lm-tab.lm-tab--active::after {
    transform: scaleX(1);
}

/* ── Panels ───────────────────────────── */
.lm-panel {
    /* shown/hidden via display:none in JS */
}

/* ── Título dentro del panel ──────────── */
.lm-title {
    font-family: var(--font-h);
    font-size: 20px;
    font-weight: 700;
    color: var(--sara-deepest);
    margin-bottom: 18px;
}

/* ── Campos (replicados de auth.css sin necesitar auth.css) ── */
.lm-card .auth-field {
    margin-bottom: 14px;
}

.lm-card .auth-input-wrap {
    display: flex;
    align-items: center;
    background: var(--sara-bg);
    border: 1px solid var(--sara-border);
    border-radius: 10px;
    padding: 0 14px;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.lm-card .auth-input-wrap:focus-within {
    border-color: var(--sara);
    box-shadow: 0 0 0 3px rgba(0, 154, 219, 0.1);
}

.lm-card .auth-icon {
    flex-shrink: 0;
    color: var(--sara-gray-lt);
    margin-right: 10px;
}

.lm-card .auth-input-wrap input {
    flex: 1;
    border: none;
    background: none;
    padding: 12px 0;
    font-size: 14px;
    font-family: var(--font-b);
    color: var(--sara-deepest);
    outline: none;
    min-width: 0;
}

.lm-card .auth-input-wrap input::placeholder {
    color: var(--sara-gray-lt);
}

.lm-card .auth-toggle-pw {
    background: none;
    border: none;
    padding: 4px;
    color: var(--sara-gray-lt);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.lm-card .auth-toggle-pw:hover {
    color: var(--sara-gray);
}

.lm-card .auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 13px;
    flex-wrap: wrap;
    gap: 8px;
}

.lm-card .auth-remember {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--sara-gray);
    cursor: pointer;
}

.lm-card .auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--sara);
    cursor: pointer;
    flex-shrink: 0;
}

.lm-card .auth-forgot,
.lm-card .lm-tab-switch {
    background: none;
    border: none;
    padding: 0;
    color: var(--sara);
    font-weight: 500;
    font-size: 13px;
    font-family: var(--font-b);
    cursor: pointer;
    transition: color 0.2s;
}

.lm-card .auth-forgot:hover,
.lm-card .lm-tab-switch:hover {
    color: var(--sara-dark);
}

.lm-card .auth-btn {
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    background: var(--sara);
    color: var(--sara-white);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-b);
    border: none;
    transition: background 0.25s var(--ease), transform 0.25s var(--ease);
    cursor: pointer;
}

.lm-card .auth-btn:hover {
    background: var(--sara-dark);
    transform: translateY(-1px);
}

/* Estado de carga: spinner + bloqueo (anti-doble-envío, dux §7.4) */
.lm-card .auth-btn.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
    opacity: 0.85;
}

.lm-card .auth-btn.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid color-mix(in srgb, var(--sara-white) 40%, transparent);
    border-top-color: var(--sara-white);
    border-radius: 50%;
    animation: lmBtnSpin 0.6s linear infinite;
}

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

.lm-card .auth-subtitle {
    font-size: 13px;
    color: var(--sara-gray);
    line-height: 1.5;
    margin-bottom: 20px;
}

.lm-card .auth-footer-link {
    text-align: center;
    margin-top: 16px;
}

.lm-back-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    color: var(--sara);
    font-weight: 500;
    font-family: var(--font-b);
    cursor: pointer;
    transition: color 0.2s;
}

.lm-back-btn:hover {
    color: var(--sara-dark);
}

/* ── Signup link ──────────────────────── */
.lm-signup {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--sara-gray);
}

.lm-signup a {
    color: var(--sara);
    font-weight: 600;
    margin-left: 4px;
    transition: color 0.2s;
}

.lm-signup a:hover {
    color: var(--sara-dark);
}

/* ══════════════════════════════════════
   RESPONSIVE ≤ 640px
   ══════════════════════════════════════ */
@media (max-width: 640px) {
    .lm-card {
        padding: 24px 20px 22px;
        border-radius: 14px;
        max-width: 100%;
    }

    .lm-title {
        font-size: 18px;
    }

    .lm-tab {
        font-size: 12px;
        padding: 7px 8px 9px;
    }
}

/* ══════════════════════════════════════
   RESPONSIVE ≤ 360px
   ══════════════════════════════════════ */
@media (max-width: 360px) {
    .lm-overlay {
        padding: 8px;
        align-items: flex-end;
    }

    .lm-card {
        padding: 20px 16px 20px;
        border-radius: 14px 14px 0 0;
        max-width: 100%;
        width: 100%;
    }

    .lm-card .auth-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .lm-card .auth-btn {
        font-size: 14px;
        padding: 12px;
    }
}
