/* ===============================
   AUTH MODAL (login / register)
   =============================== */

/* Backdrop y apertura */
.auth-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
    /* evita pegue en pantallas chicas */
}

.auth-backdrop.show {
    display: flex;
    animation: auth-fade-in .18s ease-out both;
}

/* Contenedor */
.auth-modal {
    width: min(560px, 92vw);
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 24px;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(8px);
    animation: auth-pop .22s ease-out both;
    color: var(--light, #f1f5f9);
}

/* Cerrar */
.auth-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: 0;
    color: var(--light, #f1f5f9);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    opacity: .8;
    transition: opacity .2s, transform .15s;
}

.auth-close:hover {
    opacity: 1;
    transform: scale(1.04);
}

.auth-close:focus-visible {
    outline: 2px solid var(--accent, #06b6d4);
    outline-offset: 2px;
}

/* Título */
.auth-title {
    font-family: 'Oxanium', cursive;
    margin: 0 0 14px 0;
}

/* Tabs */
.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.auth-tab {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--light, #f1f5f9);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
}

.auth-tab:hover {
    transform: translateY(-1px);
}

.auth-tab.active {
    background: var(--gradient, linear-gradient(135deg, #2563eb, #7e22ce));
    border-color: transparent;
}

.auth-tab:focus-visible {
    outline: 2px solid var(--accent, #06b6d4);
    outline-offset: 2px;
}

/* Formularios */
.auth-form.hidden {
    display: none;
}

.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #cbd5e1;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
    width: 100%;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--light, #f1f5f9);
    padding: 12px 14px;
    border-radius: 8px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.field input:focus {
    border-color: rgba(6, 182, 212, 0.6);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.18);
}

/* Estados nativos de validación */
.field input:invalid[required] {
    border-color: rgba(220, 38, 38, 0.6);
}

.field input:invalid[required]:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Botones */
.auth-submit {
    width: 100%;
    margin-top: 8px;
}

.auth-submit[disabled],
.auth-submit[aria-disabled="true"] {
    opacity: .6;
    cursor: not-allowed;
    filter: saturate(.7);
}

/* Alertas */
.auth-alert {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #fecaca;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

/* Aceptación de términos */
.agree-field {
    margin-top: 8px;
}

.agree-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.agree-label input[type="checkbox"] {
    margin-top: 3px;
    transform: translateY(1px);
    accent-color: var(--accent, #06b6d4);
    /* navegadores modernos */
}

.agree-label a {
    color: var(--accent, #06b6d4);
    text-decoration: none;
}

.agree-label a:hover {
    text-decoration: underline;
}

/* Animaciones */
@keyframes auth-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes auth-pop {
    from {
        transform: translateY(16px);
    }

    to {
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 520px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .auth-modal {
        padding: 18px;
        border-radius: 12px;
    }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .auth-backdrop.show {
        animation: none;
    }

    .auth-modal {
        animation: none;
    }

    .auth-close,
    .auth-tab {
        transition: none;
    }
}