/* --- Estructura del Modal Auth (Full Screen Overlay) --- */

#auth-modal,
#sessions-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

#auth-modal .modal-content,
#sessions-modal .modal-content {
    background-color: var(--bg-secondary);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2rem;
    box-sizing: border-box;
    position: relative;
    letter-spacing: var(--smart-spacing);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: authModalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authModalFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Cabecera del Modal --- */

#auth-modal .modal-close-bar {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 0;
    z-index: 100;
}

#close-auth-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s ease;
}

#close-auth-modal:hover {
    color: var(--text-main);
}

#auth-modal .modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.75rem;
    border-bottom: none;
    padding-bottom: 0;
}

.auth-header-icon {
    width: 24px;
    height: 24px;
    color: var(--main-purple);
    margin-bottom: 4px;
}

#auth-modal-title {
    font-family: var(--font-secondary);
    font-weight: 600;
    font-size: clamp(1rem, 2.8vw, 1.15rem);
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

/* --- Cuerpo del Modal --- */

#auth-modal-body {
    text-align: center;
}

/* --- Inputs --- */

.auth-input-group {
    position: relative;
    margin-bottom: 1.2rem;
    width: 100%;
}

#auth-modal .auth-input-group input[type="text"],
#auth-modal .auth-input-group input[type="password"] {
    width: 100%;
    height: 60px;
    padding: 1.2rem 1.2rem 0;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    font-weight: 500;
    color: var(--text-main);
    background-color: var(--bg-main);
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-input-group label {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    font-weight: 500;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#auth-modal input:focus~label,
#auth-modal input:not(:placeholder-shown)~label {
    top: 25%;
    font-size: clamp(0.7rem, 2vw, 0.75rem);
    font-weight: 700;
    color: var(--main-purple);
    transform: translateY(-50%);
}

#auth-modal input:focus {
    border-color: var(--main-purple);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--main-purple), transparent 92%);
    outline: none;
}

/* --- Botones --- */

.auth-button {
    background-color: var(--main-purple);
    color: white;
    border: none;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: clamp(0.95rem, 2.5vw, 1.05rem);
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-button:hover {
    background-color: var(--main-purple-action);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-button:disabled {
    background-color: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
    transform: none;
}

/* --- Switch Text & Link --- */

.auth-switch-text {
    font-size: clamp(0.85rem, 2.2vw, 0.9rem);
    color: var(--text-muted);
    margin-top: 1.25rem;
    line-height: 1.4;
}

.link-button {
    background: transparent;
    border: none;
    color: var(--main-purple);
    font-size: clamp(0.85rem, 2.2vw, 0.9rem);
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0;
    margin-top: 2px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.link-button:hover {
    border-bottom-color: var(--main-purple);
}

/* --- Divider --- */

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 1rem;
    font-size: clamp(0.7rem, 2vw, 0.75rem);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.auth-google-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

/* --- Footer --- */

.auth-modal-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer-text {
    font-size: clamp(0.75rem, 2.2vw, 0.8rem);
    color: var(--text-muted);
    line-height: 1.6;
}

.auth-footer-link {
    color: var(--text-main);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-footer-link:hover {
    color: var(--main-purple);
}

/* --- Paso 2 (Credenciales) --- */

.auth-credential-display {
    background: var(--bg-main);
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    margin-bottom: 0.75rem;
    text-align: left;
}

.auth-credential-display label {
    display: block;
    font-size: clamp(0.65rem, 2vw, 0.7rem);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.auth-credential-display input {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-size: clamp(1rem, 2.8vw, 1.15rem) !important;
    color: var(--main-purple) !important;
    font-family: var(--font-secondary) !important;
    font-weight: 600 !important;
}

.auth-note {
    font-size: clamp(0.8rem, 2.2vw, 0.85rem);
    color: var(--text-body);
    background: color-mix(in srgb, var(--main-purple), transparent 95%);
    padding: 0.85rem;
    border-radius: 8px;
    margin: 1.25rem 0;
    border-left: 4px solid var(--main-purple);
    line-height: 1.4;
}

.copy-all-button {
    font-size: clamp(0.8rem, 2.2vw, 0.88rem) !important;
    background-color: var(--bg-hover) !important;
    color: var(--text-muted) !important;
    border: 1.5px solid var(--border-color) !important;
    box-shadow: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    padding: 0.85rem !important;
    cursor: pointer !important;
}

.copy-all-button:hover {
    background-color: var(--border-color) !important;
    color: var(--text-main) !important;
    transform: translateY(-1px) !important;
}

.copy-all-button.success {
    background-color: var(--status-success) !important;
    color: white !important;
    border-color: var(--status-success) !important;
    transform: scale(0.98) !important;
}

/* --- Error Messages --- */

.error-message {
    color: var(--status-alert);
    font-size: clamp(0.8rem, 2.2vw, 0.85rem);
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: color-mix(in srgb, var(--status-alert), transparent 94%);
    border-radius: 8px;
    border-left: 3px solid var(--status-alert);
}

/* --- Media Queries --- */

@media (max-width: 480px) {
    #auth-modal .modal-content {
        padding: 2rem 1.5rem;
    }

    .auth-divider {
        margin: 1.2rem 0;
    }
}