/**
 * WebAuthn Styles — Mobile-first
 * Login biométrico en móvil, estándar en desktop
 */

/* Ocultar elementos por default */
.desktop-only {
    display: none;
}

.mobile-only {
    display: block;
}

/* Tabs para móvil */
.login-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.login-tabs button {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.login-tabs button.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
}

.login-tabs button:hover {
    color: #333;
}

/* Panels */
.tab-panel {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-panel.active {
    display: block;
}

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

/* Panel de biometría */
#panel-biometric {
    text-align: center;
}

#btn-webauthn-login {
    display: block;
    background: none;
    border: none;
    padding: 4px 0 10px;
    margin: 0 auto;
    cursor: pointer;
    color: var(--primary);
    width: auto;
    font-size: inherit;
}

#btn-webauthn-login:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Email input */
#email-biometric {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

#email-biometric:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Fallback link */
#fallback-password {
    display: block;
    margin-top: 12px;
    color: #0066cc;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s;
}

#fallback-password:hover {
    color: #004499;
    text-decoration: underline;
}

/* Desktop — mostrar solo login estándar */
@media (min-width: 768px) {
    .desktop-only {
        display: block;
    }

    .mobile-only {
        display: none;
    }

    .login-tabs {
        display: none;
    }

    .tab-panel {
        display: block !important;
    }

    /* Ocultar tab de biometría en desktop */
    #panel-biometric {
        display: none;
    }
}

/* Estado disabled de tabs */
.login-tabs button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-tabs button:disabled:hover {
    color: #666;
}

/* Mensaje de no soportado */
.webauthn-not-supported {
    padding: 16px;
    background: #f5f5f5;
    border-radius: 6px;
    color: #999;
    text-align: center;
    font-size: 14px;
}

/* Loading state */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0066cc;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }
    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Configuración WebAuthn (admin/configurar_webauthn.php) */
.webauthn-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.webauthn-card-info {
    flex: 1;
}

.webauthn-card-name {
    font-weight: 600;
    color: #333;
}

.webauthn-card-meta {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.webauthn-card-actions {
    display: flex;
    gap: 8px;
}

.btn-revoke {
    padding: 6px 12px;
    font-size: 12px;
    color: #d9534f;
    border: 1px solid #d9534f;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-revoke:hover {
    background: #d9534f;
    color: white;
}

#btn-register-biometric {
    padding: 12px 20px;
    font-size: 14px;
    background: #5cb85c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

#btn-register-biometric:hover {
    background: #4cae4c;
}

#btn-register-biometric:active {
    transform: scale(0.98);
}

/* Indicadores de estado */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active {
    background: #5cb85c;
    color: white;
}

.badge-revoked {
    background: #f5f5f5;
    color: #999;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .login-tabs button {
        font-size: 13px;
        padding: 10px;
    }

.webauthn-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .webauthn-card-actions {
        margin-top: 12px;
        width: 100%;
    }

    .btn-revoke {
        flex: 1;
    }
}
