/* ===================================================
   MODAL.CSS - Modal de autenticación
   =================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    /* Alpine.js controla la visibilidad con x-show */
    justify-content: center;
    align-items: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 1rem;
}

.modal-content {
    position: relative;
    animation: scaleIn 0.3s ease;
}

/* --- Tarjeta de autenticación --- */
.auth-card {
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
}

/* --- Botón cerrar --- */
.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-tertiary);
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    z-index: 10;
}

.close-modal i {
    width: 18px;
    height: 18px;
}

.close-modal:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* --- Encabezado del modal --- */
.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.auth-logo .logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
}

.logo-img-lg {
    height: 64px;
    width: auto;
    max-width: 240px;
    display: block;
    margin: 0 auto;
}

.auth-logo .logo-icon i {
    width: 24px;
    height: 24px;
}

.auth-header h2 {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* --- Pestañas (Tabs) --- */
.tabs {
    display: flex;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.65rem;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    transition: all var(--transition-base);
}

.tab-btn.active {
    background: var(--bg-secondary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* --- Formulario de auth --- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 0.85rem;
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 0.85rem 0.75rem 2.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    outline: none;
    transition: all var(--transition-fast);
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

/* --- Botón auth --- */
.btn-auth {
    padding: 0.85rem;
    font-size: var(--font-size-sm);
    margin-top: 0.25rem;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Separador --- */
.divider {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    line-height: 0.1em;
    margin: 1.25rem 0;
}

.divider span {
    background: var(--bg-secondary);
    padding: 0 0.75rem;
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

/* --- Botón Google --- */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.btn-google:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-tertiary);
}

/* --- Contenedor de Google GSI --- */
.google-signin-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 1.25rem;
    min-height: 40px;
    /* Evitar saltos de layout */
}

/* Forzar que el div de Google se comporte como bloque centrado */
#g_id_signin {
    display: flex !important;
    justify-content: center !important;
    margin: 0 auto !important;
}

/* --- Error message --- */
.auth-error {
    text-align: center;
    color: #991b1b;
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-lg);
    animation: shake 0.4s ease;
}

/* --- Success message --- */
.auth-success {
    text-align: center;
    color: #065f46;
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-lg);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}