/* ==========================================================================
   Modal Auth — Todos los estados
   login · register · welcome · activate · activated · noads
   ========================================================================== */

/* Backdrop */
.auth-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(10, 5, 8, .65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-modal-backdrop--open {
    display: flex;
}

/* Card base */
.modal-auth {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 400px;
    max-width: 100%;
    max-height: 90dvh;
    overflow-y: auto;
    padding: 40px 36px 32px;
    animation: modalIn .25s cubic-bezier(.4, 0, .2, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal-auth--register { width: 420px; }
.modal-auth--success,
.modal-auth--activate,
.modal-auth--noads    { text-align: center; padding: 48px 36px 40px; }

/* Botón cerrar */
.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s;
}

.modal__close:hover { background: var(--gray-200); color: var(--gray-700); }
.modal__close svg   { width: 14px; height: 14px; }

/* Cabecera */
.modal__header {
    text-align: center;
    margin-bottom: 28px;
}

.modal__icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gray-400);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal__icon svg { width: 24px; height: 24px; color: var(--white); }

.modal__icon--error { background: linear-gradient(135deg, var(--red-500), #f87171); }

.modal__title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.modal__subtitle { font-size: .85rem; color: var(--gray-400); }

/* Links inferiores */
.modal__links {
    text-align: center;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal__links a {
    font-size: .825rem;
    color: var(--gray-500);
    text-decoration: none;
    font-weight: 500;
}

.modal__links a:hover { text-decoration: underline; }
.modal__links .secondary-link { color: var(--gray-400); }
.modal__links .secondary-link strong { color: var(--gray-600); }

/* Context message */
.modal__context {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: -8px 0 18px;
    padding: 10px 14px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .82rem;
    color: var(--gray-600);
    line-height: 1.45
}

.modal__context svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-top: 1px
}

/* ── Formularios ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .9rem;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--gray-500);
    box-shadow: 0 0 0 3px rgba(100, 100, 100, .1);
}

.form-input::placeholder { color: var(--gray-400); }

.form-input--error { border-color: var(--red-500); background: var(--red-50); }
.form-input--error:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, .1); }

.form-input-wrapper { position: relative; }

.form-input-wrapper .form-input {
    padding-right: 44px;
}

/* Oculta el control de revelado nativo de Edge/IE para no duplicar el ojo. */
.form-input-wrapper input[type="password"]::-ms-reveal,
.form-input-wrapper input[type="password"]::-ms-clear {
    display: none;
}

.form-input-wrapper .toggle-pw {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 8px;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-input-wrapper .toggle-pw svg { width: 16px; height: 16px; }

.form-input-wrapper .toggle-pw[aria-pressed="true"]::after {
    content: "";
    position: absolute;
    width: 19px;
    border-top: 2px solid currentColor;
    transform: rotate(45deg);
}

.form-input-wrapper .toggle-pw:focus-visible {
    outline: 2px solid var(--gray-500);
    outline-offset: 1px;
    border-radius: 4px;
}

.form-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--red-50);
    border: 1px solid var(--red-100);
    border-radius: var(--radius-sm);
    font-size: .78rem;
    color: var(--red-500);
    line-height: 1.4;
}

.form-error svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.form-success {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--green-50);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    font-size: .78rem;
    color: var(--green-500);
    line-height: 1.4;
}

.form-success svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.form-select {
    width: 100%;
    padding: 12px 36px 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .9rem;
    color: var(--gray-800);
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: border-color .2s, box-shadow .2s;
}

.form-select:focus {
    outline: none;
    border-color: var(--gray-500);
    box-shadow: 0 0 0 3px rgba(100, 100, 100, .1);
}

/* ── Estado: success / activate ──────────────────────────────────────── */
.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green-500), #4ade80);
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(34, 197, 94, .25);
}

.success-icon svg { width: 36px; height: 36px; color: var(--white); }

.activate-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    background: var(--gray-400);
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
}

.activate-icon svg { width: 32px; height: 32px; color: var(--white); }

.noads-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gray-100);
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.success-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.success-text {
    font-size: .875rem;
    color: var(--gray-500);
    line-height: 1.6;
    margin-bottom: 28px;
}

.noads-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.noads-text { font-size: .85rem; color: var(--gray-400); margin-bottom: 24px; }

/* ── Botones dentro del modal ────────────────────────────────────────── */
.modal-auth .btn-primary {
    width: 100%;
    padding: 13px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--gray-600);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    transition: transform .2s, box-shadow .2s, background .2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.modal-auth .btn-primary:hover {
    transform: translateY(-1px);
    background: var(--gray-500);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
}

.modal-auth .btn-primary--pill {
    width: auto;
    border-radius: var(--radius-full);
    padding: 12px 36px;
}

.modal-auth .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--white);
    color: var(--gray-700);
    transition: all .2s;
}

.modal-auth .btn-secondary:hover {
    border-color: var(--gray-400);
    color: var(--gray-900);
    background: var(--gray-50);
}

.modal-auth .btn-outline-fuchsia {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: 2px solid var(--gray-500);
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--gray-600);
    transition: all .2s;
}

.modal-auth .btn-outline-fuchsia:hover {
    background: var(--gray-500);
    color: var(--white);
    border-color: var(--gray-500);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}

@media (max-width: 512px) {
    .auth-modal-backdrop {
        padding: 0;
        align-items: flex-start;
        z-index: 500;
    }

    .modal-auth {
        position: fixed;
        inset: 0;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 28px 20px 32px;
    }

    .modal-auth--success,
    .modal-auth--activate,
    .modal-auth--noads {
        padding: 48px 20px 40px;
    }
}
